Agent tools
Write tools an agent can call, find platform tools, and decide when a tool returns a result or asks the model to retry.
Write tools an agent can call, find platform tools, and decide when a tool returns a result or asks the model to retry.
Tools
-
Import individual platform tools from
andon_dsl.toolsand opt them into an agent explicitly:from andon_dsl.agents import Agent from andon_dsl.tools import parse_document from andon_dsl.tools.toolsets import document_analysis reader = Agent(prompt="Read {{document}}.", tools=[parse_document]) analyst = Agent(prompt="Analyse {{document}}.", tools=document_analysis.tools)andon platform-tools list --search <text>finds tools for the selected organization. Useandon platform-tools show <name>to read one tool’s call schema, effective settings, and prices. For example, inspectparse_documentto see the available parsing qualities. Add--offlineto use the installed SDK without credentials, and--jsonfor structured output. Theinstalled_signature, connections, and toolset memberships come from the local SDK. Use the signed-incall_schemafor the options the workspace accepts. -
Every platform tool is available through
StepContext; calls are awaited, includingctx.json_validate(...). In agent code mode,json_validate(...)is synchronous as shown in its tool signature. -
Inspect a document tool with
andon platform-tools show <name>. Add--offlineto read the installed signature and output type. For selected-page recovery, callawait ctx.parse_document(source, pages="12-14", quality="high", use_intelligent_routing=False), then read the returnedrefwithread_pages. Consult the catalog for qualities, routing, reuse, and upload scope. -
Artifact reads and writes are always available. Other tools enforce their organization enablement settings.
-
Organization settings apply to fresh platform calls. Completed agent tool calls replay their recorded result and usage. A disabled tool or an unavailable parsing quality fails before external work.
-
The docstring is the tool description the model sees. It is required, and the most important prompt you write for the tool.
-
A pure user tool omits context. A user tool needing platform capabilities declares
ctx: StepContextfirst; the typed context parameter is injected and never shown to the model. Pass agent data through explicit typed tool arguments. User tool bodies have the sameStepContextcapability set as steps: model prompts, connections, artifact I/O, and document reads. -
A user tool that calls
ctx.connect(...)grants the sameConnectionRefin@tool(connections=[...]). Every step that can invoke an agent carrying that tool grants that ref in@step(connections=[...]). -
Raise
AgentRetryErroronly for repairable model mistakes (malformed argument, an id the model invented). A legitimate miss (“no catalog entry for this code”) is a result: return an empty list/Noneand say “an empty result is the final answer; do not retry” in the docstring. Rule of thumb: anAgentRetryErrorshould be unreachable for a well-behaved model on valid data: each raise consumes the agent’s retry budget, and consecutive raises from the same tool kill the run. -
UserReadableErrorfrom a tool ends the agent call. The model gets no feedback and no chance to repair the call, whether it called the tool directly or from a code-mode cell: the step that called the agent fails, and the run shows the message as it would from a step body. A tool raises it on the terms Error taxonomy sets for all workflow code, to reject what the person who started the run supplied; an argument the model chose is the model’s to repair.