agentcc
Python SDK for the AgentCC gateway — OpenAI-compatible, typed, with first-class streaming, tools, structured output, guardrails, and cost tracking.
Install
pip install agentcc
Python 3.9+ required.
Usage
Basic chat completion
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
# 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
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
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
License
Apache 2.0 — see LICENSE.
Metadata
Release files for agentcc 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentcc-1.0.0.tar.gz | 135.0 kB | Without provenance | Details for agentcc-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentcc-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for agentcc-1.0.0-py3-none-any.whl |
Total release size: 226.2 kB
Release files / agentcc-1.0.0.tar.gz
| Download URL | agentcc-1.0.0.tar.gz |
|---|---|
| Size | 135.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e8737b3e921a681c95d2cdebe5ef992353a38dcc0bece592eb444f3b15aaf76
|
|
BLAKE2b-256 checksum How to use checksums |
2b263352950470e178e2842d01b964a5925caf834c14de9727b2370eb24721cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / agentcc-1.0.0-py3-none-any.whl
| Download URL | agentcc-1.0.0-py3-none-any.whl |
|---|---|
| Size | 91.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2eb341ee1ad626e663d6bb875a44145c425ea84d457d0e85dab1c1cd18fea803
|
|
BLAKE2b-256 checksum How to use checksums |
b730ed8697b2aa75ffdd8db1cc2a396ceb7f4ddfe0d38a259f3adced1f3a7170
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for agentcc 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.