> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doconda.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Agents SDK

> Generate Word, PowerPoint, Excel and PDF files from an OpenAI Agents SDK agent.

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
pip install openai-agents doconda
```

## With the Python SDK

`doconda.tools()` is JSON Schema, which the Agents SDK takes in `FunctionTool`:

```python theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
import asyncio
import json

from agents import Agent, FunctionTool, Runner
from doconda import Doconda


def as_function_tool(t):
    async def invoke(ctx, args: str):
        return json.dumps(await asyncio.to_thread(t.run, json.loads(args)))

    return FunctionTool(
        name=t.name,
        description=t.description,
        params_json_schema=t.input_schema,
        on_invoke_tool=invoke,
        strict_json_schema=False,
    )


agent = Agent(
    name="Documents",
    instructions="Create the documents the user asks for and return their links.",
    model="gpt-5",
    tools=[as_function_tool(t) for t in Doconda().tools()],
)

result = Runner.run_sync(agent, "Write a memo for the team: the office is closed on Friday")
print(result.final_output)
```

`strict_json_schema=False` because strict mode makes every field required, and almost all of Doconda's are optional
(`prompt` or `markdown`, `style`, `name`…). With the [Python SDK](/en/sdk/python).

## With MCP

```python theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
import asyncio
import os

from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp


async def main():
    async with MCPServerStreamableHttp(
        name="doconda",
        params={
            "url": "https://api.eu.doconda.com/mcp",
            "headers": {"Authorization": f"Bearer {os.environ['DOCONDA_API_KEY']}"},
        },
        client_session_timeout_seconds=300,
    ) as doconda:
        agent = Agent(name="Documents", model="gpt-5", mcp_servers=[doconda])
        result = await Runner.run(agent, "Make an Excel file with the event budget")
        print(result.final_output)


asyncio.run(main())
```

`client_session_timeout_seconds` raises the wait per call (5 s by default): a document takes longer to be ready.
Locally, instead of the remote server:

```python theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
from agents.mcp import MCPServerStdio

MCPServerStdio(
    name="doconda",
    params={"command": "npx", "args": ["-y", "@doconda/mcp"], "env": {"DOCONDA_API_KEY": "ak_eu_…"}},
    client_session_timeout_seconds=300,
)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.