Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ai-stats.phaseo.app/llms.txt

Use this file to discover all available pages before exploring further.

Use this recipe when a Python workflow needs:
  • one local lookup tool
  • one bounded agent loop
  • one strict JSON output shape

1. Install the SDKs

pip install ai-stats-py-sdk ai-stats-agent-sdk

2. Define one local tool

from ai_stats_agent import AgentTool, define_tool

lookup_policy = define_tool(
    AgentTool(
        id="lookup-policy",
        description="Look up one internal policy by slug.",
        parameters={
            "type": "object",
            "properties": {
                "slug": {"type": "string"},
            },
            "required": ["slug"],
            "additionalProperties": False,
        },
        execute=lambda input, ctx: {
            "slug": input["slug"],
            "summary": "Presets centralize routing, prompts, and caching defaults.",
        },
    )
)

3. Create the agent

from ai_stats_agent import create_agent

agent = create_agent(
    {
        "id": "policy-extractor",
        "model": "openai/gpt-5.4-nano",
        "instructions": "Use tools when needed and return concise JSON.",
        "tools": [lookup_policy],
        "parse_output": lambda text: text,
    }
)

4. Run through the gateway-backed client

from ai_stats_agent import create_gateway_agent_client

result = agent.run(
    input="Look up presets and return JSON with keys summary and recommendation.",
    client=create_gateway_agent_client(),
)

print(result.output)

5. When this recipe fits

  • one Python worker owns the orchestration
  • the tool surface is local and deterministic
  • you want strict output without building a larger orchestration layer first
Last modified on May 19, 2026