Skip to main content

Quickstart

Everything here runs offline, from a checkout (see Installation): no model, no proxy.

1. Run a pipeline of deterministic components​

Components are declared in SKILL.md files and implemented in code; a pipeline is a spec that wires them. The text pack ships document_digest (text statistics plus top keywords).

examples/docs/text_digest.py
"""Run the text pack's ``document_digest`` pipeline: deterministic components, no model."""

from __future__ import annotations

from agent_fabric import build_registry
from agent_fabric.executor import PipelineExecutor
from agent_fabric.pipeline import parse_plan
from text_pack import register

registry = build_registry([register]) # components, pipelines and artifact types of the text domain
plan = parse_plan(registry.pipeline("document_digest").instantiate({"top_k": 3}), registry)
report = PipelineExecutor(registry).run(
plan, {"text": "Nitrogen improved grain filling. Nitrogen uptake limited phosphorus uptake."}
)
assert report.ok
print([o.step_id for o in report.outcomes]) # ['stats', 'kw']
print(report.artifacts.get("kw.terms")) # ['nitrogen', 'uptake', 'improved']

parse_plan validates the plan (structure, registry, ports, types) and reports all errors at once as a typed PlanValidationError (see Handle errors). The executor then runs the steps in dependency order and skips the dependents of a failed step.

2. Run an agent tree​

An agent tree is declared with AGENT.md files plus a fabric.md (root agent, budget, model aliases). The notes demo has one planner agent: the model plans which components to run, the components do the work. A ScriptedBackend replays two model answers: the plan, then the output of a runtime: prompt step.

examples/docs/notes_agent.py
"""Run the code-free ``notes`` agent tree with a scripted model: the model plans, a prompt component writes."""

from __future__ import annotations

from pathlib import Path

from agent_fabric import build_registry
from agent_fabric.agents import AgentFabric, AgentsConfig
from agent_fabric.llm import ScriptedBackend
from agent_fabric.report import render_markdown

NOTES = Path(__file__).resolve().parent.parent / "notes"

backend = ScriptedBackend(
[
'{"objective": "digest", "steps": [{"id": "s", "component": "summarize_notes"}]}', # the planner's answer
'{"summary": "Ship on Friday; Ana owns the release notes."}', # the prompt step's answer
]
)
fabric = AgentFabric(build_registry(), AgentsConfig.load(NOTES), backend=backend)
report = fabric.run("Digest this meeting", {"transcript": "We agreed to ship on Friday. Ana owns the release notes."})
assert report.result.status == "ok"
print(report.usage) # {'agent_runs': 1, 'delegations': 0, 'llm_calls': 2}
print(render_markdown(report)) # agent tree, per-agent results and the event trace

Every LLM call is charged to the budget in fabric.md (max_llm_calls, max_depth, …). To use a real model instead of the scripted one, see Use a real model.

3. Next​

Pick a domain pack and run its example on your own data.