Skip to main content
AI agents use tool definitions to decide when and how to call external services. This example shows how to define Andi search as a tool that your agent can invoke to retrieve current web information.

Tool definition

Define the search tool with a description, parameters, and expected output:

Tool execution

When the agent calls the tool, execute the search and return results:

Putting it together

Here’s how the tool fits into an agent loop:

Using format=context for agents

For agents that pass search results directly into conversation context, format=context returns pre-formatted markdown:
format=context reduces the code in your tool executor — no JSON parsing or formatting needed. The tradeoff is less control over result structure.

Other agent frameworks

The same pattern works with any agent framework. See Build with AI agents for MCP server integration, which lets tools like Claude Code and Cursor access the docs directly.

Next steps

Build with AI agents

MCP server, llms.txt, and markdown access.

RAG pipeline

Search as retrieval context for LLMs.

Query parameters

Full parameter reference.

Error handling

Error codes and retry strategies.