API Reference

5 min read
38 sections
Edit this page

Complete API reference for all deep agent classes, their parameters, methods, return types, and factory methods.


GoalAgent

Autonomous agent that decomposes goals into sub-tasks and tracks progress against success criteria.

Constructor

python
GoalAgent(
    *,
    llm: LLM,                              # required — LLM adapter
    goal: Goal,                             # required — goal with criteria
    tools: list[Tool] | None = None,        # custom tools
    mcps: list[MCPServer] | None = None,    # MCP servers
    use_builtins: bool = False,             # attach all 30+ built-in tools
    prompt: str = "You are a helpful...",   # system prompt for inner agent
    **agent_kwargs,                          # extra Agent kwargs
)

Factory

python
GoalAgent.with_builtins(*, llm, goal, mcps=None, **kwargs) -> GoalAgent

Methods

MethodReturnsDescription
run()GoalResultExecute goal synchronously
stream()Iterator[AgentEvent]Execute with real-time event streaming

GoalResult

FieldTypeDescription
goalGoalThe original goal
outputstrFinal output text
goal_statusstr"completed", "partial", or "failed"
criteria_metlist[bool]Per-criterion pass/fail
steps_takenintNumber of steps executed
step_outputslist[dict]Per-step task and output

Goal

FieldTypeDefaultDescription
objectivestrrequiredWhat to achieve
success_criterialist[str][]How to measure success
max_stepsint20Maximum sub-tasks

Stream events

EventWhen
run_startedGoal execution begins
planning_startedDecomposing goal into sub-tasks
planning_completedSub-tasks ready (payload: subtasks)
step_startedStarting a sub-task
tool_called / tool_completedInner agent tool usage
run_completedGoal finished (payload: status, criteria_met)

ReflectiveAgent

Agent that produces output, reflects critically, and revises until quality threshold is met.

Constructor

python
ReflectiveAgent(
    *,
    llm: LLM,
    tools: list[Tool] | None = None,
    mcps: list[MCPServer] | None = None,
    reflection_prompt: str = "Check for accuracy...",
    max_reflections: int = 3,
    quality_threshold: float = 0.8,
    use_builtins: bool = False,
    prompt: str = "You are a helpful...",
    **agent_kwargs,
)

Factory

python
ReflectiveAgent.with_builtins(*, llm, mcps=None, **kwargs) -> ReflectiveAgent

Methods

MethodReturnsDescription
run(task: str)ReflectionResultExecute with reflection loop
stream(task: str)Iterator[AgentEvent]Execute with real-time streaming

ReflectionResult

FieldTypeDescription
outputstrFinal revised output
reflectionslist[Reflection]Each reflection's feedback + score
revisionslist[str]Each version of the output
final_qualityfloatLast quality score (0.0-1.0)
iterationsintNumber of reflection cycles

Reflection

FieldType
feedbackstr
quality_scorefloat
revision_neededbool

Stream events

EventWhen
run_startedTask begins
step_startedGenerating output or revising
reasoning_startedStarting a reflection
reasoning_completedReflection done (payload: quality, feedback)
run_completedThreshold met or max reflections reached

AdaptiveAgent

Agent that can create new tools at runtime from Python code.

Constructor

python
AdaptiveAgent(
    *,
    llm: LLM,
    tools: list[Tool] | None = None,
    mcps: list[MCPServer] | None = None,
    can_create_tools: bool = True,
    sandbox: bool = True,
    use_builtins: bool = False,
    prompt: str = "You are a helpful...",
    **agent_kwargs,
)

Factory

python
AdaptiveAgent.with_builtins(*, llm, mcps=None, **kwargs) -> AdaptiveAgent

Methods

MethodReturnsDescription
create_tool(name, description, code)FunctionToolCreate and register a new tool
run(task: str)AgentResultExecute with all tools
stream(task: str)Iterator[AgentEvent]Execute with streaming

Properties

PropertyTypeDescription
created_toolslist[CreatedTool]Record of all dynamically created tools
toolslist[Tool]All available tools (including created)

Supervisor

Hierarchical agent that plans, delegates to workers, reviews quality, and combines results.

Constructor

python
Supervisor(
    *,
    llm: LLM,
    workers: list[Worker],
    strategy: str = "plan_and_delegate",
    allow_parallel: bool = False,
    max_delegations: int = 15,
)

Factory

python
Supervisor.with_builtins(
    *,
    llm: LLM,
    worker_configs: list[dict],    # [{"name": "...", "prompt": "...", "capabilities": [...]}]
    mcps: list[MCPServer] | None = None,
    **kwargs,
) -> Supervisor

Methods

MethodReturnsDescription
run(task: str)SupervisorResultExecute with delegation loop
stream(task: str)Iterator[AgentEvent]Execute with real-time streaming

Worker

FieldTypeDescription
namestrWorker identifier
agentAgentThe agent that does the work
capabilitieslist[str]What this worker can do

SupervisorResult

FieldTypeDescription
outputstrFinal combined output
delegationslist[Delegation]Round-by-round history
total_roundsintHow many rounds were used

Stream events

EventWhen
run_startedSupervisor begins (payload: workers)
planning_startedDeciding next delegation
tool_calledDelegating to worker (payload: worker, task)
tool_completedWorker finished (payload: worker, output)
tool_failedUnknown worker requested
run_completedTask complete or max rounds

PersistentAgent

Agent with checkpoint/resume capability for long-running tasks.

Constructor

python
PersistentAgent(
    *,
    llm: LLM,
    tools: list[Tool] | None = None,
    checkpoint_dir: str = ".shipit_checkpoints",
    checkpoint_interval: int = 5,
    max_steps: int = 50,
)

Methods

MethodReturnsDescription
run(task, *, agent_id)AgentResultExecute with periodic checkpointing
resume(agent_id)AgentResultResume from last checkpoint
status(agent_id)dictCheck progress ("paused" or "not_found")

Channel

Typed communication channel for agent-to-agent message passing.

Constructor

python
Channel(name: str = "default")

Methods

MethodReturnsDescription
send(message)NoneSend to target agent's queue
receive(*, agent, timeout=None)AgentMessage | NoneGet next message (FIFO)
ack(message)NoneMark message as acknowledged
history()list[AgentMessage]All sent messages
pending(*, agent)intCount unread messages

AgentMessage

FieldTypeDescription
from_agentstrSender name
to_agentstrReceiver name
typestrMessage type (e.g. "research_complete")
datadictStructured payload
requires_ackboolWhether ack is expected
acknowledgedboolWhether ack was received

AgentBenchmark

Systematic testing framework for agents.

Constructor

python
AgentBenchmark(*, name: str, cases: list[TestCase])

TestCase

FieldTypeDefaultDescription
inputstrrequiredPrompt to send to agent
expected_containslist[str][]Output must contain these
expected_not_containslist[str][]Output must NOT contain these
expected_toolslist[str][]These tools must be used
max_iterationsint10Max allowed iterations

Methods

MethodReturnsDescription
run(agent)BenchmarkReportRun all test cases

BenchmarkReport

PropertyTypeDescription
passedintCount of passing tests
failedintCount of failing tests
totalintTotal test count
pass_ratefloatRatio (0.0 - 1.0)
summary()strHuman-readable report
to_dict()dictJSON-serializable export