Loading…
Loading…
Features · Build · The Agent
shipit_agent.Agent is the runtime. Give it a model and a task: it decides the next step, calls a tool, reads the result and keeps going until the work is done. Every other agent in the library runs one underneath.
from shipit_agent import Agentfrom shipit_agent.llms import build_llm_from_envllm = build_llm_from_env()# Every built-in tool: files, search, bash, the web, todos and sub-agents.agent = Agent.with_builtins(llm=llm, project_root=".")result = agent.run("Run the tests and fix what fails.")
Your task
agent.run("…")
Model
decides the next step
Tools
read, search, run, edit
Answer
result.output, with the record
Watch one run, a moment at a time.
Each step lights up as the lines it produces appear. Pause it, or step through it yourself.
0 of 7 · Your task
Your task
agent.run("…")
Model
decides the next step
Tools
read, search, run, edit
Answer
result.output, with the record
The code is a checked example from the docs; the output is an example of what it prints.
from shipit_agent import Agent
from shipit_agent.llms import build_llm_from_env
llm = build_llm_from_env()
# Every built-in tool: files, search, bash, the web, todos and sub-agents.
agent = Agent.with_builtins(llm=llm, project_root=".")
result = agent.run("Run the tests and fix what fails.")
print(result.output)12 more ways to use it
Each example is from the docs and checked against the library.
from shipit_agent import Agent
from shipit_agent.llms import build_llm_from_env
llm = build_llm_from_env()
# Only the tools you give it.
agent = Agent(llm=llm, tools=[...])
# Every built-in tool: files, search, bash, the web, todos, sub-agents and services.
agent = Agent.with_builtins(llm=llm, project_root=".")
# A project agent: built-in tools, plus the repository's .shipit/settings.json,
# SHIPIT.md or AGENTS.md instructions and /slash commands from .shipit/commands/.
agent = Agent.for_project(llm=llm, project_root=".", optimized=True)Three ways to build one
Agent() with your own tools, Agent.with_builtins() with all of them, Agent.for_project() with the repository's settings.
Four ways to run it
run, stream, arun and astream: an answer or live events, from sync or async code.
A full record
The result holds the answer, every message, each tool result, token counts and the estimated cost.
Text, images and files
Every call takes images= and files=, which the model sees with the prompt.
| Parameter | Default | What it does |
|---|---|---|
| llm | required | The model adapter. |
| decision_llm | None | Accepted for compatibility and no longer used for progress narration, which costs no model call at all now. Kept so existing callers keep working rather than raising on an unexpected keyword. |
| progress_summaries | False | Emit public `agent_decision` / `agent_observation` progress events. Decisions use only prose the primary model already produced; observations use factual tool metadata. |
| reminder | None | Short standing instruction placed at the very END of the context on every step. Use it for the one or two requirements that must hold every time; a model attends far more reliably to the tokens closest to generation than to the top of a long system prompt. |
| evict_prior_tool_outputs | True | Replace earlier turns' tool payloads with a short notice, keeping the calls and arguments. A tool result is re-sent on every request of every later turn; once its content is in the answer below it, the payload is pure cost. |
| media_parser | None | A `shipit_agent.multimodal.MediaParser` (or compatible). When set, inline media references in the user prompt — `[https://…/x.png]`, `!alt`, `[media:id]` — are turned into image/document content blocks on the user turn. |
| prompt | the default prompt | The system prompt. |
| tools | empty | The tools the agent may call. |
| mcps | empty | MCP servers whose tools join the agent's. |
| required_tools | empty | Tool names that must execute before this run may finish. The runtime advertises only these tools and uses native required-tool mode first, then resets to automatic selection after they have run. |
| require_tool_call | False | Require at least one available tool on the first model step, without constraining which one. Mirrors provider `tool_choice="required"`. |
| max_required_tool_text_chars | 2048 | Stop a provider that ignores required tool choice from spending its whole output budget narrating a call. The partial prose is discarded and the bounded recovery step receives the same required tool contract. |
| max_completion_text_chars | 0 | Optional provider-neutral circuit breaker for one completion's visible text. Zero leaves the provider's token limit authoritative. |
| max_tool_argument_chars | 65536 | Provider-neutral circuit breaker for one structured tool call's JSON arguments. This bounds runaway generations before they reach a tool; increase it for tools that intentionally accept very large documents. |
| name | 'shipit' | The agent's name, in events and traces. |
| description | '' | What the agent does; used when it is a tool of another agent. |
| metadata | empty | Free-form data carried on events and results. |
| history | empty | Messages to start the conversation with. |
| memory_store | None | Where the `memory` tool saves facts. Memory. |
| session_store | None | Where conversations are saved between runs. Sessions. |
| credential_store | None | Where connector credentials are read from. |
| trace_store | None | Where run traces are written. |
| observability | 'auto' | Report this agent's runs through shipit-watcher — traces, the agent graph, scores, datasets and the local ledger. `True` attaches it, `False` never does, and the default `"auto"` attaches it only when shipit-watcher is installed *and* configured with credentials. |
| session_id | None | The conversation to continue. |
| trace_id | None | The trace id for this agent's runs. |
| max_iterations | None | Most model steps a run may take. `None` (the default) means no limit: the run ends when the model answers without calling a tool. |
| max_turns | None | Another name for `max_iterations`; set either one. |
| retry_policy | empty | Retries for transient model and tool errors. RetryPolicy. |
| fallback_model | None | Used when the model fails after its retries: a model id, ids separated by commas, an adapter, or a list of them (see `llms/fallback.py`). |
| router_policy | empty | When to plan before the first turn. RouterPolicy. |
| parallel_tool_execution | True | Run a response's tool calls concurrently when every one is read-only. Writes and unknown tools always run one at a time, in order. |
| max_tool_concurrency | None | None means no cap; otherwise bound concurrent local tool calls per turn. |
| hooks | None | Code run before and after model calls and tools. Hooks. |
| plugins | empty | Drop-in plugin packs: Plugin objects or catalog names. Each contributes tools and lifecycle hooks, folded in at construction (see shipit_agent.plugins). |
| gate_unavailable_tools | True | Hide tools whose declared dependency is missing (a CLI binary not on PATH, an unset env var, a failing `check_fn`) so their schema never costs tokens and the model never wastes a turn calling something that cannot run. Only tools that *declare* requirements can be gated, so this is safe to leave on: a tool with no declaration is always kept. |
| context_window_tokens | 0 | 0 = automatic model limit; positive = explicit limit; -1 = disabled. |
| clear_tool_results | None | Clear old tool results from each request on long tasks (the history keeps them): True, or a ToolResultClearing. See context/tool_result_clearing.py. |
| fixed_prefix_tokens | 0 | The fixed prompt prefix (system prompt + tool schemas) is sent on every call but lives outside `messages`, so the compaction trigger under-counts the real prompt by this whole prefix unless it is told. A host that knows its prefix size can pass an estimate here to make compaction accurate from the first turn; leaving it 0 lets the token calibrator learn the gap over a few completions instead. |
| max_tool_output_chars | 16000 | Bound only the model-visible copy; AgentResult keeps complete tool output. Capped by default: a message list is cumulative, so one 138,000-character tool result is not paid once — it is re-sent on every turn that follows it. |
| max_tool_output_group_chars | 48000 | Parallel calls share this model-context budget. Complete outputs remain available in AgentResult and live tool events. |
| persist_large_tool_outputs | False | Optimized agents spill complete large results under .shipit so the model can fetch omitted sections without paying for the whole body every turn. |
| replan_interval | 0 | Re-plan every N turns; `0` never. Re-planning. |
| stream_queue_maxsize | 256 | How many events `stream()` buffers before the run waits for the reader. |
| cancel_on_stream_close | True | Cancel the run when the reader stops iterating `stream()`. |
| stream_join_timeout | 2.0 | Seconds to wait for the run's thread when a stream closes. |
| rag | None | A RAG the agent searches and cites. RAG with an agent. |
| verifier | None | Optional `VerifierNetwork` that runs pre-tool veto checks on every tool call and (when used in autopilot-style loops) progress checks between iterations. See `shipit_agent/verifier/`. |
| permission_mode | 'default' | Rule-based gate over tool calls. Set a mode ("default" | "acceptEdits" | "plan" | "bypass"), or pass a full `PermissionEngine` / kwargs dict via `permissions`, or a `permission_callback(name, args) -> PermissionResult | None` for programmatic human-in-the-loop approval. |
| permissions | None | A `PermissionEngine`, a mode name or a dict of its settings. Permissions. |
| permission_callback | None | `(tool_name, arguments) -> PermissionResult | None`, for calls that would ask. |
| harness | None | A :class:`~shipit_agent.harness.Harness`: plugins and settings files. |
| allowed_tools | empty | Pre-approved calls, as SDK rules: `"Read"`, `"Bash(npm test *)"`. They approve; they do not restrict the other tools. |
| disallowed_tools | empty | A bare name removes the tool from the run; a scoped rule such as `"Bash(rm *)"` denies matching calls in every permission mode. |
| guardrails | None | A `Guardrails` instance: blocks prompt-injection inputs, redacts secrets/PII from outputs, and denies tool calls whose arguments match configured patterns. See `shipit_agent.guardrails`. |
| approvals | None | An `ApprovalQueue` (or `True` for a fresh one). Side-effecting tools the policy marks `ask` are queued instead of blocking the run; you approve later, in bulk. |
| code_mode | False | Collapse the tool catalogue into a small core set plus an `env` of resource bindings reachable from `execute_code`. Cuts the tool-schema block by ~79% and lets one call compose several resources. |
| deferred_tools | 'auto' | Default "auto": above ten tools, keep nine core capabilities and a discovery tool. discovery_priority on a tool overrides core ranking; ties follow registration order. |
| lockdown | None | Once a tool reports it returned sensitive data, the run may only make observations — every action is denied for the rest of the run, so the data cannot leave through another tool. Honours declarations by default and detects nothing; pass a LockdownPolicy to add detection, or False to disable. |
| verify_before_stop | False | Evidence-gated coding: refuse to finish a turn that edited code without fresh passing tests (the verification ledger + verify-on-stop guard). Off by default — it changes the loop's stop behaviour, so a caller opts in. |
| delegation | None | Reach for sub-agents without being asked: guarantee a `sub_agent` tool exists, and when a task carries delegation signals (a per-item verb, an enumerated work list, a wide sweep) append a directive naming what was detected. The model still decides — it decides with the tool present and the case put plainly. |
| heal_tool_calls | True | Promote tool calls that small models emit as TEXT (<tool_call> tags, fenced JSON, bare call-shaped JSON) into structured calls. Response- side only; only declared tool names qualify. |
| project_root | '/tmp' | The folder the file tools and bash work in; paths outside it are refused. |
| auto_project_memory | True | Auto-load SHIPIT.md / AGENTS.md project instructions into the system prompt, and expand `/slash` commands from .shipit/commands/ on run(). |
| skill_registry | None | A `SkillRegistry` to choose skills from. |
| skill_source | see code | A folder or catalog file to load skills from. |
| auto_use_skills | True | Pick skills that match the prompt automatically. |
| auto_project_skills | True | Load skills from the project's `.shipit/skills/`. |
| skills | empty | Skills to attach to every run, by id or object. |
| default_skill_ids | empty | Skill ids always active. |
| skill_match_limit | 3 | Most skills chosen for one prompt. |
| progressive_skills | True | Skills load on demand: the prompt lists each in one line and the model reads one with `load_skill` when it needs it. False restores keyword matching that injects whole skills. |
| advertise_packaged_skills | False | List the library's packaged skill catalog too. Off by default: the catalog lists the project's own SKILL.md files and any registry you pass; packaged skills stay usable by id through `skills=[...]`. |
| agents | empty | Named sub-agents: `{"reviewer": { "description": ..., "prompt": ..., "tools": [...], "model": ...}}`. Defining any gives the agent a `sub_agent` tool that lists them. |
| auto_project_agents | True | Also read sub-agents from `.shipit/agents/*.md` and `.claude/agents/*.md`. |
| max_task_tokens | None | Stop the run after this many tokens. |
| max_budget_usd | None | Stop a run, between steps, once its estimated cost reaches this many US dollars. Needs pricing data for the model; without it the run stops rather than spend unchecked. |
| max_session_tokens | None | Soft stop across every run of this agent (or one chat session), checked between steps. Clones start fresh; reset with reset_session_usage(). |
| rules | empty | Durable behavioural policy (AGENTS.md house-style), scoped to paths/tools and ordered by priority — the complement to skills' capability. Strings, dicts, or Rule objects; discovered `.shipit/rules/*.md` are merged in when auto_project_rules is on. |
| auto_project_rules | True | Read rules from the project's `AGENTS.md` and rule files. |