---
title: Agent tools
description: "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.tools` and opt them into an
  agent explicitly:

  ```python
  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. Use `andon platform-tools show <name>` to read one tool's
  call schema, effective settings, and prices. For example, inspect
  `parse_document` to see the available parsing qualities. Add `--offline`
  to use the installed SDK without credentials, and `--json` for structured
  output. The `installed_signature`, connections, and toolset memberships
  come from the local SDK. Use the signed-in `call_schema` for the options
  the workspace accepts.
- Every platform tool is available through `StepContext`; calls are awaited,
  including `ctx.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
  `--offline` to read the installed signature and output type. For selected-page recovery,
  call `await ctx.parse_document(source, pages="12-14", quality="high",
  use_intelligent_routing=False)`, then read the returned `ref` with
  `read_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: StepContext` first; 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 same `StepContext` capability set as
  steps: model prompts, connections, artifact I/O, and document reads.
- A user tool that calls `ctx.connect(...)` grants the same `ConnectionRef` in
  `@tool(connections=[...])`. Every step that can invoke an agent carrying that
  tool grants that ref in `@step(connections=[...])`.
- **Raise `AgentRetryError` only 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/`None` and say "an empty result is the final answer; do not
  retry" in the docstring. Rule of thumb: an `AgentRetryError` should 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.
- **`UserReadableError` from 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](/authoring/testing-and-debugging#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.
