Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ dist
.envrc
codegen.log
Brewfile.lock.json

.codeartifact-pip-conf
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.18
3.12
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.0.1-alpha.1"
".": "0.1.0-alpha.1"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 36
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-021b55c88964b7a5bfc9d692d32a52c6b0150445656d2407c4cb8e9dd1e5f100.yml
openapi_spec_hash: ed92c0d5d6bed9cb5617f8a776ac42c9
config_hash: ea7ccb4f8ed1981b364cef82aa595243
configured_endpoints: 34
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-1d08fb2290b5310c91801d7575d356628d372fd5434e15d3b9cead48eadb893f.yml
openapi_spec_hash: 216a0edbf4e1a3cde23329d4f385faed
config_hash: 7661726e3cccf9f6349179841153601d
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.1 (2025-07-22)

Full Changelog: [v0.0.1-alpha.1...v0.1.0-alpha.1](https://github.com/scaleapi/agentex-python/compare/v0.0.1-alpha.1...v0.1.0-alpha.1)

### Features

* **api:** manual updates ([06f5fe1](https://github.com/scaleapi/agentex-python/commit/06f5fe115ace5ec4ca8149cd0afa6207b193a04c))

## 0.0.1-alpha.1 (2025-07-22)

Full Changelog: [v0.0.1-alpha.0...v0.0.1-alpha.1](https://github.com/scaleapi/agentex-python/compare/v0.0.1-alpha.0...v0.0.1-alpha.1)
Expand Down
48 changes: 25 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ pip install git+ssh://[email protected]/scaleapi/agentex-python.git
The full API of this library can be found in [api.md](api.md).

```python
import os
from agentex import Agentex

client = Agentex(
api_key=os.environ.get("AGENTEX_SDK_API_KEY"), # This is the default and can be omitted
# defaults to "production".
environment="development",
)

response = client.echo.send(
message="message",
agent = client.agents.retrieve(
"agent_id",
)
print(agent.id)
```

While you can provide an `api_key` keyword argument,
Expand All @@ -50,19 +51,20 @@ so that your API Key is not stored in source control.
Simply import `AsyncAgentex` instead of `Agentex` and use `await` with each API call:

```python
import os
import asyncio
from agentex import AsyncAgentex

client = AsyncAgentex(
api_key=os.environ.get("AGENTEX_SDK_API_KEY"), # This is the default and can be omitted
# defaults to "production".
environment="development",
)


async def main() -> None:
response = await client.echo.send(
message="message",
agent = await client.agents.retrieve(
"agent_id",
)
print(agent.id)


asyncio.run(main())
Expand Down Expand Up @@ -91,12 +93,12 @@ from agentex import AsyncAgentex

async def main() -> None:
async with AsyncAgentex(
api_key="My API Key",
http_client=DefaultAioHttpClient(),
) as client:
response = await client.echo.send(
message="message",
agent = await client.agents.retrieve(
"agent_id",
)
print(agent.id)


asyncio.run(main())
Expand Down Expand Up @@ -127,8 +129,8 @@ from agentex import Agentex
client = Agentex()

try:
client.echo.send(
message="message",
client.agents.retrieve(
"agent_id",
)
except agentex.APIConnectionError as e:
print("The server could not be reached")
Expand Down Expand Up @@ -172,8 +174,8 @@ client = Agentex(
)

# Or, configure per-request:
client.with_options(max_retries=5).echo.send(
message="message",
client.with_options(max_retries=5).agents.retrieve(
"agent_id",
)
```

Expand All @@ -197,8 +199,8 @@ client = Agentex(
)

# Override per-request:
client.with_options(timeout=5.0).echo.send(
message="message",
client.with_options(timeout=5.0).agents.retrieve(
"agent_id",
)
```

Expand Down Expand Up @@ -240,13 +242,13 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
from agentex import Agentex

client = Agentex()
response = client.echo.with_raw_response.send(
message="message",
response = client.agents.with_raw_response.retrieve(
"agent_id",
)
print(response.headers.get('X-My-Header'))

echo = response.parse() # get the object that `echo.send()` would have returned
print(echo)
agent = response.parse() # get the object that `agents.retrieve()` would have returned
print(agent.id)
```

These methods return an [`APIResponse`](https://github.com/scaleapi/agentex-python/tree/main/src/agentex/_response.py) object.
Expand All @@ -260,8 +262,8 @@ The above interface eagerly reads the full response body when you make the reque
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.

```python
with client.echo.with_streaming_response.send(
message="message",
with client.agents.with_streaming_response.retrieve(
"agent_id",
) as response:
print(response.headers.get("X-My-Header"))

Expand Down
68 changes: 30 additions & 38 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
# Agentex

Methods:

- <code title="get /">client.<a href="./src/agentex/_client.py">get_root</a>() -> object</code>

# Echo

Methods:

- <code title="post /echo">client.echo.<a href="./src/agentex/resources/echo.py">send</a>(\*\*<a href="src/agentex/types/echo_send_params.py">params</a>) -> object</code>

# Agents

Types:

```python
from agentex.types import AcpType, Agent, AgentRpcRequest, AgentListResponse
from agentex.types import (
AcpType,
Agent,
AgentRpcParams,
AgentRpcRequest,
AgentRpcResponse,
AgentRpcResult,
DataDelta,
TaskMessageContent,
TaskMessageDelta,
TaskMessageUpdate,
TextDelta,
ToolRequestDelta,
ToolResponseDelta,
AgentListResponse,
)
```

Methods:

- <code title="get /agents/{agent_id}">client.agents.<a href="./src/agentex/resources/agents/agents.py">retrieve</a>(agent_id) -> <a href="./src/agentex/types/agent.py">Agent</a></code>
- <code title="get /agents">client.agents.<a href="./src/agentex/resources/agents/agents.py">list</a>(\*\*<a href="src/agentex/types/agent_list_params.py">params</a>) -> <a href="./src/agentex/types/agent_list_response.py">AgentListResponse</a></code>
- <code title="delete /agents/{agent_id}">client.agents.<a href="./src/agentex/resources/agents/agents.py">delete</a>(agent_id) -> <a href="./src/agentex/types/agent.py">Agent</a></code>
- <code title="post /agents/{agent_id}/rpc">client.agents.<a href="./src/agentex/resources/agents/agents.py">rpc</a>(agent_id, \*\*<a href="src/agentex/types/agent_rpc_params.py">params</a>) -> object</code>

## Name

Methods:

- <code title="get /agents/name/{agent_name}">client.agents.name.<a href="./src/agentex/resources/agents/name.py">retrieve</a>(agent_name) -> <a href="./src/agentex/types/agent.py">Agent</a></code>
- <code title="delete /agents/name/{agent_name}">client.agents.name.<a href="./src/agentex/resources/agents/name.py">delete</a>(agent_name) -> <a href="./src/agentex/types/agent.py">Agent</a></code>
- <code title="post /agents/name/{agent_name}/rpc">client.agents.name.<a href="./src/agentex/resources/agents/name.py">rpc</a>(agent_name, \*\*<a href="src/agentex/types/agents/name_rpc_params.py">params</a>) -> object</code>
- <code title="get /agents/{agent_id}">client.agents.<a href="./src/agentex/resources/agents.py">retrieve</a>(agent_id) -> <a href="./src/agentex/types/agent.py">Agent</a></code>
- <code title="get /agents">client.agents.<a href="./src/agentex/resources/agents.py">list</a>(\*\*<a href="src/agentex/types/agent_list_params.py">params</a>) -> <a href="./src/agentex/types/agent_list_response.py">AgentListResponse</a></code>
- <code title="delete /agents/{agent_id}">client.agents.<a href="./src/agentex/resources/agents.py">delete</a>(agent_id) -> <a href="./src/agentex/types/agent.py">Agent</a></code>
- <code title="delete /agents/name/{agent_name}">client.agents.<a href="./src/agentex/resources/agents.py">delete_by_name</a>(agent_name) -> <a href="./src/agentex/types/agent.py">Agent</a></code>
- <code title="get /agents/name/{agent_name}">client.agents.<a href="./src/agentex/resources/agents.py">retrieve_by_name</a>(agent_name) -> <a href="./src/agentex/types/agent.py">Agent</a></code>
- <code title="post /agents/{agent_id}/rpc">client.agents.<a href="./src/agentex/resources/agents.py">rpc</a>(agent_id, \*\*<a href="src/agentex/types/agent_rpc_params.py">params</a>) -> <a href="./src/agentex/types/agent_rpc_response.py">AgentRpcResponse</a></code>
- <code title="post /agents/name/{agent_name}/rpc">client.agents.<a href="./src/agentex/resources/agents.py">rpc_by_name</a>(agent_name, \*\*<a href="src/agentex/types/agent_rpc_by_name_params.py">params</a>) -> <a href="./src/agentex/types/agent_rpc_response.py">AgentRpcResponse</a></code>

# Tasks

Expand All @@ -43,18 +41,13 @@ from agentex.types import Task, TaskListResponse

Methods:

- <code title="get /tasks/{task_id}">client.tasks.<a href="./src/agentex/resources/tasks/tasks.py">retrieve</a>(task_id) -> <a href="./src/agentex/types/task.py">Task</a></code>
- <code title="get /tasks">client.tasks.<a href="./src/agentex/resources/tasks/tasks.py">list</a>() -> <a href="./src/agentex/types/task_list_response.py">TaskListResponse</a></code>
- <code title="delete /tasks/{task_id}">client.tasks.<a href="./src/agentex/resources/tasks/tasks.py">delete</a>(task_id) -> <a href="./src/agentex/types/task.py">Task</a></code>
- <code title="get /tasks/{task_id}/stream">client.tasks.<a href="./src/agentex/resources/tasks/tasks.py">stream_events</a>(task_id) -> object</code>

## Name

Methods:

- <code title="get /tasks/name/{task_name}">client.tasks.name.<a href="./src/agentex/resources/tasks/name.py">retrieve</a>(task_name) -> <a href="./src/agentex/types/task.py">Task</a></code>
- <code title="delete /tasks/name/{task_name}">client.tasks.name.<a href="./src/agentex/resources/tasks/name.py">delete</a>(task_name) -> <a href="./src/agentex/types/task.py">Task</a></code>
- <code title="get /tasks/name/{task_name}/stream">client.tasks.name.<a href="./src/agentex/resources/tasks/name.py">stream_events</a>(task_name) -> object</code>
- <code title="get /tasks/{task_id}">client.tasks.<a href="./src/agentex/resources/tasks.py">retrieve</a>(task_id) -> <a href="./src/agentex/types/task.py">Task</a></code>
- <code title="get /tasks">client.tasks.<a href="./src/agentex/resources/tasks.py">list</a>() -> <a href="./src/agentex/types/task_list_response.py">TaskListResponse</a></code>
- <code title="delete /tasks/{task_id}">client.tasks.<a href="./src/agentex/resources/tasks.py">delete</a>(task_id) -> <a href="./src/agentex/types/task.py">Task</a></code>
- <code title="delete /tasks/name/{task_name}">client.tasks.<a href="./src/agentex/resources/tasks.py">delete_by_name</a>(task_name) -> <a href="./src/agentex/types/task.py">Task</a></code>
- <code title="get /tasks/name/{task_name}">client.tasks.<a href="./src/agentex/resources/tasks.py">retrieve_by_name</a>(task_name) -> <a href="./src/agentex/types/task.py">Task</a></code>
- <code title="get /tasks/{task_id}/stream">client.tasks.<a href="./src/agentex/resources/tasks.py">stream_events</a>(task_id) -> object</code>
- <code title="get /tasks/name/{task_name}/stream">client.tasks.<a href="./src/agentex/resources/tasks.py">stream_events_by_name</a>(task_name) -> object</code>

# Messages

Expand All @@ -65,7 +58,6 @@ from agentex.types import (
DataContent,
MessageAuthor,
MessageStyle,
StreamingStatus,
TaskMessage,
TextContent,
ToolRequestContent,
Expand Down
46 changes: 46 additions & 0 deletions examples/tutorials/00_sync/000_hello_acp/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Environments
.env**
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# IDE
.idea/
.vscode/
*.swp
*.swo

# Git
.git
.gitignore

# Misc
.DS_Store

# CodeArtifact configuration
.codeartifact-pip-conf
45 changes: 45 additions & 0 deletions examples/tutorials/00_sync/000_hello_acp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# syntax=docker/dockerfile:1.3
FROM python:3.12-slim
COPY --from=ghcr.io/astral-sh/uv:0.6.4 /uv /uvx /bin/

# Install system dependencies
RUN apt-get update && apt-get install -y \
htop \
vim \
curl \
tar \
python3-dev \
postgresql-client \
build-essential \
libpq-dev \
gcc \
cmake \
netcat-openbsd \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN uv pip install --system --upgrade pip setuptools wheel

ENV UV_HTTP_TIMEOUT=1000

# Copy just the requirements file to optimize caching
COPY 000_hello_acp/requirements.txt /app/requirements.txt

WORKDIR /app/

# Install the required Python packages
RUN --mount=type=secret,id=codeartifact-pip-conf,target=/etc/pip.conf \
export UV_INDEX_URL=$(grep -E "^index-url" /etc/pip.conf | cut -d'=' -f2- | xargs) && \
export UV_EXTRA_INDEX_URL=$(grep -E "^extra-index-url" /etc/pip.conf | cut -d'=' -f2- | xargs || echo "") && \
uv pip install --system -r requirements.txt

# Copy the project code
COPY 000_hello_acp/project /app/project

WORKDIR /app/project

# Set environment variables
ENV PYTHONPATH=/app

# Run the agent using uvicorn
CMD ["uvicorn", "acp:acp", "--host", "0.0.0.0", "--port", "8000"]
Loading
Loading