Skip to main content
Build production-ready AI agents with Pydantic AI’s type-safe framework and direct access to business data through StackOne’s Tools.
Supported languages: Python.
  • Type-safe agents with Pydantic validation
  • Structured outputs with full type checking
  • Dynamic tool loading based on StackOne Linked Accounts
  • OpenAI-compatible tool integration

Calling actions

1

Install

2

Fetch Tools

Two approaches to retrieving tools:
  1. Fetch Tools (with filtering) — fetch all tools upfront with optional filters applied.
  2. Search & Execute — hand the model just tool_search + tool_execute and let the agent discover what it needs at runtime.
See Tool Discovery for more details on which may be best in your scenario.
Fetch StackOne tools for the linked account and convert each one to a Pydantic AI Tool with its schema:
3

Run the agent loop

Create the agent with the tools and run it — Pydantic AI executes tool calls automatically, so the same code works for both approaches:

Structured outputs

Leverage Pydantic AI’s type-safe responses:

Best practices

Account ID from context

Error handling

Multi-account usage

Each tool execution runs against a specific customer account. Set account IDs once on the toolset, or pass them per request.
Actions that download a file (for example googledrive_unified_download_file, documents_download_file, or any *_unified_download_file) return raw bytes plus metadata, not parsed JSON. The SDK decides from the response Content-Type: JSON is parsed as usual, and anything else is treated as a file download.call() and execute() both return the dict directly (it isn’t wrapped in a result object), so read its values with dict keys like result["content"].
The returned dict, from both call() and execute():
content is raw bytes and is not JSON-serializable. If you forward tool results to an LLM (or anything that re-serializes to JSON), handle or strip the content key. For example, base64-encode it on the LLM-facing path.

Troubleshooting

Execute a tool

Direct execution is useful for testing and debugging. In production, your agent framework handles tool calls automatically.

Next steps

Observability

Diagnose failing calls and monitor what your agent runs.

Tool Defense

Protect your agent from malicious content in tool results.