-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathREADME.md.j2
More file actions
69 lines (54 loc) · 2.07 KB
/
Copy pathREADME.md.j2
File metadata and controls
69 lines (54 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# {{ agent_name }} - AgentEx Async OpenAI Agents SDK Agent
This template builds an **asynchronous** (non-Temporal) agent built on the
**OpenAI Agents SDK**, delivered through the unified harness surface on AgentEx:
- Defines an OpenAI Agents SDK `Agent` (with an example weather tool) inline in
`acp.py`
- Wraps the SDK run in an `OpenAITurn`
- Delivers canonical `StreamTaskMessage*` events via `UnifiedEmitter.auto_send_turn`
(the async Redis push path), so the UI receives output in real time
- Tracing integration to SGP / AgentEx
## Prerequisites
- An `OPENAI_API_KEY` in your environment (or a `LITELLM_API_KEY`, which is
copied to `OPENAI_API_KEY` for LiteLLM-proxy compatibility)
## Running the Agent
```bash
agentex agents run --manifest manifest.yaml
```
## Project Structure
```
{{ project_name }}/
├── project/
│ ├── __init__.py
│ └── acp.py # ACP server, agent + tool definitions, event handlers
├── Dockerfile
├── manifest.yaml
├── dev.ipynb
{% if use_uv %}
└── pyproject.toml
{% else %}
└── requirements.txt
{% endif %}
```
## Key Concepts
### Async ACP with the harness
The async ACP model streams events over Redis instead of an HTTP response. The
`@acp.on_task_event_send` handler runs the OpenAI Agents SDK and pushes the
harness events to the task stream.
### The unified harness surface
`OpenAITurn` + `UnifiedEmitter` are the unified harness surface. The turn
normalizes the SDK's streamed run into canonical AgentEx events; the emitter
traces and delivers them.
## Development
### 1. Add Your Own Tools
Define new `@function_tool` functions in `project/acp.py` and add them to the
agent's `tools=[...]` list in `create_agent()`.
### 2. Customize the Agent
Edit `MODEL_NAME` and `INSTRUCTIONS` in `project/acp.py` to change the model or
system prompt.
### 3. Configure Credentials
Set your credentials via `manifest.yaml`, an exported environment variable, or a
`.env` file in the project directory.
### 4. Run Locally
```bash
export ENVIRONMENT=development && agentex agents run --manifest manifest.yaml
```