Commit ceca307
authored
Add OpenAI Agent Worker (#4)
<h2>OpenAI Agent Worker</h2>
<h3>Summary</h3>
<p>Introduces a new ACP agent (<code>openai-agent</code>) that bridges
the Agent Client Protocol to any OpenAI Chat Completions API-compatible
endpoint. This enables stdio Bus users to interact with OpenAI, AWS
Bedrock, Azure OpenAI, Ollama, vLLM, LiteLLM, and other compatible
providers through a unified ACP interface.</p>
<h3>Motivation</h3>
<p>The stdio Bus Workers Registry currently supports agents from the ACP
Registry, but lacks a built-in way to connect to OpenAI-compatible APIs.
This PR fills that gap by providing a universal agent that works with
any <code>/chat/completions</code> endpoint.</p>
<h3>Changes</h3>
<p><strong>New Worker:
<code>workers-registry/openai-agent/</code></strong></p>
<ul>
<li>Full ACP protocol implementation (<code>initialize</code>,
<code>newSession</code>, <code>prompt</code>, <code>cancel</code>)</li>
<li>SSE streaming support for real-time token delivery</li>
<li>Per-session conversation history for multi-turn dialogues</li>
<li>Native <code>fetch()</code> for HTTP requests (zero external HTTP
dependencies)</li>
<li>Graceful shutdown with <code>AbortController</code> for in-flight
requests</li>
</ul>
<p><strong>Registry Launcher Enhancement</strong></p>
<ul>
<li>Added <code>--custom-agents</code> CLI argument and
<code>ACP_CUSTOM_AGENTS_PATH</code> env var support</li>
<li>Enables loading custom agent definitions from external JSON
files</li>
</ul>
<p><strong>Infrastructure</strong></p>
<ul>
<li>Registered <code>openai-agent</code> in <code>launch/index.ts</code>
for <code>npx @stdiobus/workers-registry openai-agent</code></li>
<li>Added exports to root <code>package.json</code></li>
</ul>
<h3>Configuration</h3>
<p>Environment variables:</p>
Variable | Default | Description
-- | -- | --
OPENAI_BASE_URL | https://api.openai.com/v1 | API endpoint
OPENAI_API_KEY | — | Authentication key
OPENAI_MODEL | gpt-4o | Model identifier
OPENAI_SYSTEM_PROMPT | — | Optional system prompt
OPENAI_MAX_TOKENS | — | Optional token limit
OPENAI_TEMPERATURE | — | Optional temperature
<h3>Testing</h3>
<ul>
<li>5 unit test suites covering config, session, SSE parsing, agent, and
client</li>
<li>6 property-based test suites (100+ iterations each) for protocol
invariants</li>
<li>All existing tests pass</li>
</ul>
<pre><code class="language-bash">cd workers-registry/openai-agent
&& npm test
</code></pre>
<h3>How to Verify</h3>
<ol>
<li><p>Build the worker:</p>
<pre><code class="language-bash">cd workers-registry/openai-agent
npm install && npm run build
</code></pre>
</li>
<li><p>Test with a raw NDJSON message:</p>
<pre><code class="language-bash">export OPENAI_API_KEY="sk-..."
echo
'{"jsonrpc":"2.0","id":"1","method":"initialize","params":{"clientInfo":{"name":"test","version":"1.0"}}}'
| node dist/index.js
</code></pre>
</li>
</ol>
<h3>Breaking Changes</h3>
<p>None. This is an additive feature.</p>
<h3>Checklist</h3>
<ul>
<li><input checked="" disabled="" type="checkbox"> Code compiles
(<code>npm run build</code>)</li>
<li><input checked="" disabled="" type="checkbox"> Tests pass (<code>npm
test</code>)</li>
<li><input checked="" disabled="" type="checkbox"> Protocol compliance
(stdout = NDJSON only, stderr = logs)</li>
<li><input checked="" disabled="" type="checkbox"> Documentation added
(<code>README.md</code>)</li>
<li><input checked="" disabled="" type="checkbox"> No secrets in
code</li>
</ul>
</body></html>42 files changed
Lines changed: 7817 additions & 61 deletions
File tree
- workers-registry
- acp-registry
- acp-worker
- src/registry-launcher
- config
- registry
- router
- launch
- mcp-echo-server
- mcp-to-acp-proxy
- openai-agent
- src
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
777 | 777 | | |
778 | 778 | | |
779 | 779 | | |
| 780 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 41 | + | |
45 | 42 | | |
46 | | - | |
47 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
Lines changed: 4 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
207 | 209 | | |
208 | 210 | | |
209 | | - | |
| 211 | + | |
210 | 212 | | |
211 | 213 | | |
212 | 214 | | |
| |||
229 | 231 | | |
230 | 232 | | |
231 | 233 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
| 234 | + | |
236 | 235 | | |
237 | 236 | | |
238 | 237 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
48 | 53 | | |
49 | 54 | | |
50 | 55 | | |
| |||
116 | 121 | | |
117 | 122 | | |
118 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
119 | 133 | | |
120 | 134 | | |
121 | 135 | | |
| |||
129 | 143 | | |
130 | 144 | | |
131 | 145 | | |
| 146 | + | |
132 | 147 | | |
133 | 148 | | |
134 | 149 | | |
| |||
140 | 155 | | |
141 | 156 | | |
142 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
143 | 162 | | |
144 | 163 | | |
145 | 164 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
Lines changed: 71 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
63 | 73 | | |
64 | | - | |
| 74 | + | |
65 | 75 | | |
66 | | - | |
| 76 | + | |
67 | 77 | | |
68 | | - | |
| 78 | + | |
69 | 79 | | |
70 | | - | |
71 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
72 | 104 | | |
73 | | - | |
74 | | - | |
| 105 | + | |
75 | 106 | | |
76 | 107 | | |
77 | | - | |
| 108 | + | |
78 | 109 | | |
79 | 110 | | |
80 | 111 | | |
| |||
240 | 271 | | |
241 | 272 | | |
242 | 273 | | |
243 | | - | |
244 | | - | |
245 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
246 | 277 | | |
247 | 278 | | |
248 | 279 | | |
249 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
250 | 287 | | |
251 | 288 | | |
252 | 289 | | |
| |||
271 | 308 | | |
272 | 309 | | |
273 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
274 | 331 | | |
275 | 332 | | |
276 | 333 | | |
| |||
Lines changed: 0 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | 130 | | |
158 | 131 | | |
159 | 132 | | |
| |||
0 commit comments