Skip to content

Commit eee9fa6

Browse files
authored
feat: consolidate agent control-plane onto AgentClient; fix worker credential delivery (#421)
1 parent 612821b commit eee9fa6

92 files changed

Lines changed: 5069 additions & 3764 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/agent-e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
env:
20-
AGENTSPAN_VERSION: "0.4.0" # pinned server/CLI release — bump deliberately
20+
AGENTSPAN_VERSION: "0.4.3" # pinned server/CLI release — bump deliberately
2121

2222
jobs:
2323
agent-e2e:

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ __pycache__/
33
*.py[cod]
44
*$py.class
55

6+
# Example-run artifacts (generated by run_all_examples.py / coding-agent examples)
7+
examples/agents/run_report.html
8+
examples/agents/codingexamples/
9+
610
# C extensions
711
*.so
812

AGENTS.md renamed to AGENT.md

Lines changed: 90 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,33 @@ This guide provides a complete blueprint for creating or refactoring Conductor S
1414

1515
```
1616
┌─────────────────────────────────────────────────┐
17-
│ Application Layer
18-
│ (User's Application Code)
17+
│ Application Layer │
18+
│ (User's Application Code) │
1919
└─────────────────────────────────────────────────┘
2020
2121
┌─────────────────────────────────────────────────┐
22-
│ High-Level Clients
23-
│ (OrkesClients, WorkflowExecutor, Workers)
22+
│ High-Level Clients │
23+
│ (OrkesClients, WorkflowExecutor, Workers) │
2424
└─────────────────────────────────────────────────┘
2525
2626
┌─────────────────────────────────────────────────┐
27-
│ Domain-Specific Clients
28-
│ (TaskClient, WorkflowClient, SecretClient...)
27+
│ Domain-Specific Clients │
28+
│ (TaskClient, WorkflowClient, SecretClient...) │
2929
└─────────────────────────────────────────────────┘
3030
3131
┌─────────────────────────────────────────────────┐
32-
│ Orkes Implementations
33-
│ (OrkesTaskClient, OrkesWorkflowClient...)
32+
│ Orkes Implementations │
33+
│ (OrkesTaskClient, OrkesWorkflowClient...) │
3434
└─────────────────────────────────────────────────┘
3535
3636
┌─────────────────────────────────────────────────┐
37-
│ Resource API Layer
38-
│ (TaskResourceApi, WorkflowResourceApi...)
37+
│ Resource API Layer │
38+
│ (TaskResourceApi, WorkflowResourceApi...) │
3939
└─────────────────────────────────────────────────┘
4040
4141
┌─────────────────────────────────────────────────┐
42-
│ HTTP/API Client
43-
│ (ApiClient, HTTP Transport)
42+
│ HTTP/API Client │
43+
│ (ApiClient, HTTP Transport) │
4444
└─────────────────────────────────────────────────┘
4545
```
4646

@@ -255,6 +255,84 @@ Abstract Interface (20+ methods):
255255

256256
---
257257

258+
## 🤖 Agent SDK Layer
259+
260+
An **optional higher-level layer** for building LLM agents on top of the client +
261+
worker SDK. Agents are authored in code but **compiled and executed on the server**
262+
as durable Conductor workflows; an agent's tools are ordinary Conductor **workers**
263+
(reuse the entire Worker Framework, Phase 3). Full language-agnostic spec:
264+
[`docs/design/WORKER_SDK_IMPLEMENTATION_GUIDE.md` §25](docs/design/WORKER_SDK_IMPLEMENTATION_GUIDE.md#25-agent-sdk-layer-building-agents-on-the-worker-sdk).
265+
266+
### Two Planes
267+
268+
```
269+
┌───────────────────────────────┐
270+
│ AgentRuntime │ (facade)
271+
└───────────────────────────────┘
272+
│ │
273+
control plane │ │ worker plane
274+
▼ ▼
275+
┌───────────────────────┐ ┌────────────────────────────┐
276+
│ AgentClient │ │ WorkerManager/TaskHandler │
277+
│ /agent/* over the │ │ (Phase 3 workers serve │
278+
│ standard ApiClient │ │ the agent's tools) │
279+
└───────────────────────┘ └────────────────────────────┘
280+
```
281+
282+
### Core Components
283+
284+
| Component | Role |
285+
|---|---|
286+
| `AgentRuntime` | User-facing facade: `run`/`start`/`stream`/`deploy`/`serve`/`plan` (+ async). Composes a `Configuration`, `AgentConfig`, `AgentClient`, and a `WorkerManager`. |
287+
| `AgentClient` (interface) + `OrkesAgentClient` | Control plane (compile/deploy/start/status/stream/respond/stop/signal). Built on the **standard `ApiClient`** — reuses its token management; no separate token cache. Same interface + Orkes-impl pattern as the domain clients (Phase 2). |
288+
| `AgentConfig` | Agent-runtime **behaviour** only (worker pool, liveness, streaming, integration auto-register). Connection/auth/log level come from `Configuration`. |
289+
| `RunSettings` | Per-run LLM overrides (`model`/`temperature`/`max_tokens`/…) for a single `run`/`start`; applied to the serialized agent config before start. |
290+
| Framework adapters | Run agents authored in LangChain / LangGraph / OpenAI Agents SDK / Claude Agent SDK on the durable runtime as spawn-safe passthrough workers. |
291+
292+
### Verb Contract
293+
294+
| Method | Blocks | Returns | Starts workers | Registers on server |
295+
|---|---|---|---|---|
296+
| `run` | yes | result (output + ids) | yes | via start |
297+
| `start` | no | handle (`execution_id`) | yes | via start |
298+
| `deploy` | yes | deployment info | no | yes |
299+
| `serve` | yes (until signal) || yes | yes (`serve` = `deploy` + serve) |
300+
| `plan` | yes | workflow def | no | no |
301+
302+
### Key Principles
303+
304+
- **Single token authority** — control plane *and* worker-side agent posts reuse the one `ApiClient`'s mint/cache/TTL-refresh/401-retry; never a parallel token cache. In spawned workers, rebuild + cache a client per `(server_url, auth_key)`.
305+
- **Spawn-safety** — tool/worker callables must be module-level (importable/picklable), never `<locals>` closures; entry scripts use a main-module guard.
306+
- **Credentials** — declared per tool; the server resolves + delivers them on wire-only `Task.runtimeMetadata`; injected into the worker env for the call, never read from ambient env.
307+
- **Config single-source** — connection/auth/log level live on `Configuration`; `AgentConfig` is behaviour-only.
308+
309+
### Package Additions
310+
311+
```
312+
src/conductor/
313+
├── client/
314+
│ ├── agent_client.{ext} # AgentClient interface
315+
│ └── orkes/orkes_agent_client.{ext} # OrkesAgentClient (on ApiClient)
316+
└── ai/agents/ # agent authoring + runtime
317+
├── agent.{ext}, run_settings.{ext}
318+
├── runtime/ (runtime, config, worker_manager)
319+
├── _internal/agent_http.{ext} # single token authority for /agent/* posts
320+
└── frameworks/ (langchain, langgraph, claude_agent_sdk, …)
321+
```
322+
323+
### Agent-Layer Checklist
324+
325+
- [ ] `AgentClient` interface + Orkes impl on the standard `ApiClient` (sync + async; SSE reuses the client's auth header)
326+
- [ ] `AgentRuntime` facade with the exact verb contract above
327+
- [ ] `AgentConfig` behaviour-only; connection/auth/log level from `Configuration`
328+
- [ ] `RunSettings` per-run LLM overrides
329+
- [ ] Single token authority across control plane + worker-side posts
330+
- [ ] Tool workers reuse the Worker Framework (Phase 3); credentials via `runtimeMetadata`
331+
- [ ] Framework adapters as spawn-safe passthrough workers
332+
- [ ] Liveness monitor for stateful runs
333+
334+
---
335+
258336
## 🌐 Language-Specific Implementation
259337

260338
### Java Implementation

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,20 @@ If you find [Conductor](https://github.com/conductor-oss/conductor) useful, plea
3434

3535
## Start Conductor Server
3636

37-
If you don't already have a Conductor server running, pick one:
37+
#### Conductor CLI
38+
```shell
39+
# Installs conductor cli
40+
npm install -g @conductor-oss/conductor-cli
41+
42+
# Start the open source conductor server on port 8080
43+
conductor server start
44+
# see conductor server --help for all the available commands
45+
```
46+
3847

39-
**Docker Compose (recommended, includes UI):**
48+
Alternatively, if you want to use docker
49+
50+
**Docker Compose**
4051

4152
```shell
4253
docker run -p 8080:8080 conductoross/conductor:latest
@@ -48,15 +59,6 @@ The UI will be available at `http://localhost:8080` and the API at `http://local
4859
curl -sSL https://raw.githubusercontent.com/conductor-oss/conductor/main/conductor_server.sh | sh
4960
```
5061

51-
**Conductor CLI**
52-
```shell
53-
# Installs conductor cli
54-
npm install -g @conductor-oss/conductor-cli
55-
56-
# Start the open source conductor server
57-
conductor server start
58-
# see conductor server --help for all the available commands
59-
```
6062

6163
## Install the SDK
6264

@@ -306,7 +308,7 @@ def train_model(dataset_id: str) -> dict:
306308
return {'model_id': model.id, 'accuracy': model.accuracy}
307309
```
308310
309-
Disabled by default. Enable per-worker via decorator, constructor, or environment variable (`conductor_worker_<task>_lease_extend_enabled=true`). See [LEASE_EXTENSION.md](LEASE_EXTENSION.md) for the full guide.
311+
Disabled by default. Enable per-worker via decorator, constructor, or environment variable (`conductor_worker_<task>_lease_extend_enabled=true`). See [LEASE_EXTENSION.md](docs/LEASE_EXTENSION.md) for the full guide.
310312
311313
### Monitoring with Metrics
312314
@@ -494,7 +496,7 @@ End-to-end examples covering all APIs for each domain:
494496
| [Worker Design](docs/design/WORKER_DESIGN.md) | Architecture: AsyncTaskRunner vs TaskRunner, discovery, lifecycle |
495497
| [Worker Guide](docs/WORKER.md) | All worker patterns (function, class, annotation, async) |
496498
| [Worker Configuration](WORKER_CONFIGURATION.md) | Hierarchical environment variable configuration |
497-
| [Lease Extension](LEASE_EXTENSION.md) | Automatic heartbeat for long-running tasks |
499+
| [Lease Extension](docs/LEASE_EXTENSION.md) | Automatic heartbeat for long-running tasks |
498500
| [Workflow Management](docs/WORKFLOW.md) | Start, pause, resume, terminate, retry, search |
499501
| [Workflow Testing](docs/WORKFLOW_TESTING.md) | Unit testing with mock outputs |
500502
| [Task Management](docs/TASK_MANAGEMENT.md) | Task operations |

0 commit comments

Comments
 (0)