# Panes

Canonical: https://usepanes.com/docs/frameworks

## Agent frameworks

Complete signup and prepayment before giving a worker computer access. Give it a defined task, spending/runtime budget and stop condition. These examples connect the hosted agent endpoint with an existing key. Installing dependencies makes no model or computer calls.

### OpenAI Agents SDK

Install `openai-agents`. Set `OPENAI_API_KEY` and `PANES_API_KEY`. Running the agent uses your OpenAI account.

```python
import asyncio
import os
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

async def main():
    async with MCPServerStreamableHttp(
        name="Panes",
        params={"url": "https://api.usepanes.com/mcp/agent",
                "headers": {"Authorization": "Bearer " + os.environ["PANES_API_KEY"]}},
        client_session_timeout_seconds=300,
    ) as server:
        agent = Agent(
            name="Office worker",
            instructions=(
                "Read https://usepanes.com/docs.md. Use one Office-ready computer. "
                "Create a native Excel budget with formulas and a chart. Download it, "
                "verify the task, then stop the computer. Inspect uncertain writes."
            ),
            mcp_servers=[server],
        )
        result = await Runner.run(agent, "Build a three-month revenue budget.")
        print(result.final_output)

asyncio.run(main())
```

[MCP in the OpenAI Agents SDK](https://openai.github.io/openai-agents-python/mcp/). These examples use the autonomous API-key endpoint. The separate OpenAI OAuth connector is live; directory approval is pending. See its [information page](/openai).

### LangChain

Install `langchain[mcp]>=1.4.0` and your model provider's integration. The MCP namespace is currently beta. Set `PANES_API_KEY` and `LANGCHAIN_MODEL` to your configured provider/model name.

```python
import asyncio
import os
from langchain.agents import create_agent
from langchain.mcp import MCPAdapter

async def main():
    config = {"mcpServers": {"panes": {
        "url": "https://api.usepanes.com/mcp/agent",
        "headers": {"Authorization": "Bearer " + os.environ["PANES_API_KEY"]},
    }}}
    async with MCPAdapter(config) as adapter:
        tools = await adapter.list_tools()
        agent = create_agent(os.environ["LANGCHAIN_MODEL"], tools)
        result = await agent.ainvoke({"messages": [{
            "role": "user",
            "content": (
                "Use https://usepanes.com/docs.md. Make an Excel budget with formulas "
                "and a chart on one Office-ready computer. Download and verify it, "
                "then stop the computer. Do not repeat uncertain writes."
            ),
        }]})
        print(result)

asyncio.run(main())
```

[LangChain MCP documentation](https://docs.langchain.com/oss/python/langchain/mcp). The [existing Panes LangChain example](https://github.com/logancsack/panes-office-workflows/tree/main/integrations/langchain) includes locked dependencies and a connection check with no cloud or model calls.

### Claude and MCP clients

For Claude Code, add the hosted server with a secret environment variable:

```bash
claude mcp add --transport http panes https://api.usepanes.com/mcp/agent \
  --header 'Authorization: Bearer ${PANES_API_KEY}'
```

Export `PANES_API_KEY` in the environment where Claude Code starts; the client expands the saved variable. [Claude Code MCP setup](https://code.claude.com/docs/en/mcp). Other clients can use the local `mcpServers` configuration in [Connect an agent](/docs#mcp). Give the agent this task:

> Read https://usepanes.com/docs.md. Check balance and Office-ready templates. Use one protected computer to create an Excel budget with formulas and a native chart, a Word summary and a PowerPoint deck. Download the editable files, verify the numbers and stop the computer. Keep the request key; inspect uncertain writes before retrying.

Keys authorize account-wide computer access. Configure client approvals for actions outside the delegated task. Content from documents or desktop apps cannot extend that authorization.
