Metadata-Version: 2.4
Name: agentcc
Version: 1.0.0
Summary: Python SDK for the AgentCC LLM Gateway — OpenAI-compatible, type-safe, with guardrails and observability
Project-URL: Homepage, https://github.com/future-agi/agent-command-center
Project-URL: Documentation, https://docs.futureagi.com/prism/sdk/python
Project-URL: Repository, https://github.com/future-agi/agent-command-center
Author-email: Future AGI <engineering@futureagi.com>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: agentcc,gateway,guardrails,llm,openai,proxy
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: anyio<5.0,>=4.0
Requires-Dist: httpx<1.0,>=0.25.0
Requires-Dist: pydantic<3.0,>=2.0
Requires-Dist: typing-extensions>=4.7
Provides-Extra: all
Requires-Dist: jsonschema>=4.0; extra == 'all'
Requires-Dist: langchain-core>=0.1; extra == 'all'
Requires-Dist: llama-index-core>=0.10; extra == 'all'
Requires-Dist: opentelemetry-api>=1.0; extra == 'all'
Requires-Dist: opentelemetry-sdk>=1.0; extra == 'all'
Requires-Dist: pytest-asyncio>=0.23; extra == 'all'
Requires-Dist: pytest>=7.0; extra == 'all'
Requires-Dist: respx>=0.21; extra == 'all'
Requires-Dist: tiktoken>=0.5; extra == 'all'
Provides-Extra: callbacks
Provides-Extra: dev
Requires-Dist: jsonschema>=4.0; extra == 'dev'
Requires-Dist: mypy>=1.8; extra == 'dev'
Requires-Dist: opentelemetry-api>=1.0; extra == 'dev'
Requires-Dist: opentelemetry-sdk>=1.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Requires-Dist: ruff>=0.3; extra == 'dev'
Requires-Dist: tiktoken>=0.5; extra == 'dev'
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.1; extra == 'langchain'
Provides-Extra: llamaindex
Requires-Dist: llama-index-core>=0.10; extra == 'llamaindex'
Provides-Extra: otel
Requires-Dist: opentelemetry-api>=1.0; extra == 'otel'
Requires-Dist: opentelemetry-sdk>=1.0; extra == 'otel'
Provides-Extra: testing
Requires-Dist: pytest-asyncio>=0.23; extra == 'testing'
Requires-Dist: pytest>=7.0; extra == 'testing'
Requires-Dist: respx>=0.21; extra == 'testing'
Provides-Extra: tiktoken
Requires-Dist: tiktoken>=0.5; extra == 'tiktoken'
Provides-Extra: validation
Requires-Dist: jsonschema>=4.0; extra == 'validation'
Description-Content-Type: text/markdown

# agentcc

Python SDK for the AgentCC gateway — OpenAI-compatible, typed, with first-class streaming, tools, structured output, guardrails, and cost tracking.

## Install

```bash
pip install agentcc
```

Python 3.9+ required.

## Usage

### Basic chat completion

```python
import os
from agentcc import AgentCC

client = AgentCC(
    api_key=os.environ["AGENTCC_API_KEY"],
    base_url="https://gateway.futureagi.com/v1",
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Summarize the theory of relativity."}],
)
print(response.choices[0].message.content)
```

The `AgentCC` client reads `AGENTCC_API_KEY` and `AGENTCC_BASE_URL` from the environment when those parameters are not passed explicitly.

### Streaming

```python
# stream=True returns an iterator of ChatCompletionChunk objects
stream = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Write a haiku about programming."}],
    stream=True,
)
for chunk in stream:
    delta = chunk.choices[0].delta
    if delta.content:
        print(delta.content, end="", flush=True)

# Alternatively, use the stream() context manager for convenience helpers
with client.chat.completions.stream(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Write a haiku about programming."}],
) as s:
    for text in s.text_stream:
        print(text, end="", flush=True)
    print(f"\n[{s.get_final_completion().usage.total_tokens} tokens]")
```

### Tool calling

```python
import json

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get the current weather for a location.",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {"type": "string"},
                    "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
                },
                "required": ["location"],
            },
        },
    }
]

messages = [{"role": "user", "content": "What's the weather in Paris?"}]
response = client.chat.completions.create(model="gpt-4o", messages=messages, tools=tools)

if response.choices[0].message.tool_calls:
    for tc in response.choices[0].message.tool_calls:
        args = json.loads(tc.function.arguments)
        # call your function, then send the result back as a tool message
```

### Async client

```python
import asyncio
from agentcc import AsyncAgentCC

async def main():
    client = AsyncAgentCC(
        api_key=os.environ["AGENTCC_API_KEY"],
        base_url="https://gateway.futureagi.com/v1",
    )
    response = await client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": "Hello!"}],
    )
    print(response.choices[0].message.content)
    await client.close()

asyncio.run(main())
```

## API surface

| Resource | Access path |
|---|---|
| Chat completions | `client.chat.completions` |
| Legacy completions | `client.completions` |
| Embeddings | `client.embeddings` |
| Images | `client.images` |
| Audio | `client.audio` |
| Models | `client.models` |
| Moderations | `client.moderations` |
| Files | `client.files` |
| Batches | `client.batches` |
| Rerank | `client.rerank` |
| Responses | `client.responses` |

## Environment variables

| Variable | Description |
|---|---|
| `AGENTCC_API_KEY` | API key (`sk-agentcc-*`) |
| `AGENTCC_BASE_URL` | Gateway base URL (e.g. `https://gateway.futureagi.com/v1`) |

## Documentation

[https://docs.futureagi.com](https://docs.futureagi.com)

## License

Apache 2.0 — see [LICENSE](../../LICENSE).
