Metadata-Version: 2.4
Name: agents24
Version: 0.1.2
Summary: Unified Python SDK for Agents24 agent runtime and control APIs.
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27.0
Requires-Dist: requests>=2.31.0

# agents24

Last Updated: 2026-05-25

Unified Python SDK for Agents24.

Endpoint methods are generated from `packages/agents24-sdk-contract/agents24.sdk.json`.
Do not edit files under `agents24/generated/` directly. For SDK maintenance, see `docs/references/agents24_sdk_development_guide.md`.

```python
from agents24 import Agents24

client = Agents24(
    base_url="http://localhost:8000",
    api_key="tpk_...",
    organization_id="org-id",
    project_id="project-id",
)

agent = client.agent({
    "name": "Support Agent",
    "instructions": "Answer briefly.",
}).create()

client.agents.publish(agent["id"])
```

## Published-Agent Runtime

Use `client.embed` from server code to call a published agent through the public embed runtime:

```python
def on_event(event):
    print(event["event"])

result = client.embed.stream_agent(
    "published-agent-id",
    {
        "input": "Help me with my account.",
        "external_user_id": "customer-user-123",
    },
    on_event=on_event,
)
```

The namespace also includes thread list/detail/delete, run-context, cancel, and attachment-upload methods.

## Artifact Authoring

Artifact code imports lightweight helpers from `agents24.artifacts`:

```python
from pydantic import BaseModel, Field

from agents24.artifacts import tool


class EchoInput(BaseModel):
    text: str = Field(description="Text to echo.")


class EchoOutput(BaseModel):
    text: str


@tool(
    name="echo",
    input_schema=EchoInput,
    output_schema=EchoOutput,
)
async def echo(input, config, context):
    return {"text": input["text"]}
```

The `agents24.artifacts` module is transport-free and safe for artifact runtime code. If artifact code imports Pydantic, declare `pydantic` as an artifact dependency.

## Development

```bash
pnpm run generate:sdk
pnpm run check:sdk-contract
pnpm run test:agents24-python
```

Generated endpoint methods must stay in parity with the TypeScript `@agents24/sdk` package.
