Skip to content

Commit 0479e70

Browse files
Kowserclaude
andcommitted
docs(agents): build clients via ApiClient.builder(), not AgentRuntime statics
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent d88c948 commit 0479e70

6 files changed

Lines changed: 35 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ All notable changes to this project will be documented in this file.
1212
- SSE streaming hardened: the initial connect throws `SSEUnavailableException` when the server rejects streaming (never a silently-empty stream — `stream()` degrades to status polling), `id:` frames are tracked, and mid-stream drops reconnect with a `Last-Event-ID` header; `AgentRuntime.getClient()` exposes the runtime's own `AgentClient` instance
1313
- Verb contract: `serve` = deploy + serve (each served agent is compiled + registered first, idempotently) with a non-blocking variant `serve(false, agents...)` that returns once workers are polling; `AgentHandle` gains the lifecycle verbs `send(message)` (now actually delivers `{"message": ...}` — it previously discarded the message), `stop()` (graceful, deterministic), `pause()`/`resume()` (un-pause; distinct from `AgentRuntime.resume(executionId, agent)` which re-attaches workers), `cancel(reason)`, and `getStatus()`
1414
- `RunSettings` — per-run LLM overrides (`model`, `temperature`, `maxTokens`, `reasoningEffort`, `thinkingBudgetTokens`) on `run`/`start`/`stream` and their async variants; only non-null fields override the agent (zero values apply), mutating the serialized root config so overrides flow into the LLM tasks
15-
- Connection environment: standard `CONDUCTOR_SERVER_URL`/`CONDUCTOR_AUTH_KEY`/`CONDUCTOR_AUTH_SECRET` now win over the legacy `AGENTSPAN_*` names (still honored as fallbacks); the default server URL is `http://localhost:8080` (was `6767`); blank variables no longer clobber the chain
15+
- Connection environment: standard `CONDUCTOR_SERVER_URL`/`CONDUCTOR_AUTH_KEY`/`CONDUCTOR_AUTH_SECRET` now win over the legacy `AGENTSPAN_*` names (still honored as fallbacks); the default server URL is `http://localhost:8080` (was `6767`); blank variables no longer clobber the chain. The resolution lives in the client layer — `ApiClient.builder().useEnvVariables(true)` / `new ApiClient()` — not on `AgentRuntime` (matching the Python SDK, where `AgentRuntime()` defaults to `Configuration()`); `AgentRuntime` exposes no client factories
1616
- `AgentConfig` knobs with lenient env parsing (invalid/empty → default): `autoStartWorkers`, `daemonWorkers`, `streamingEnabled`, `livenessEnabled`, `livenessStallSeconds`, `livenessCheckIntervalSeconds`
1717
- Worker credentials ride the `runtimeMetadata` wire contract: declared secret names are stamped on `TaskDef.runtimeMetadata` at (every) registration and a capable server (agentspan > 0.4.2 / conductor-oss ≥ 3.32.0-rc, conductor-oss PR #1255) delivers values on the wire-only `Task.runtimeMetadata` at poll time; dispatch is fail-closed (missing delivery → terminal failure; ambient process env is never read) — the `/workers/secrets` fetch path and its transport exceptions are deleted; see [docs/design/secret-injection-contract.md](docs/design/secret-injection-contract.md)
1818
- Liveness for stateful runs: a `SCHEDULED` task with zero polls beyond `livenessStallSeconds` surfaces as `WorkerStallError` from the handle's wait instead of burning the full timeout
1919
- Swarm hand-offs: transfer tools echo the hand-off `message`; `check_transfer` is first-wins with `transfer_message` and surfaces non-winning transfers in `dropped_transfers` (with a warning) instead of silently discarding them
2020
- `agent-e2e` GitHub workflow runs the e2e suites as a two-server matrix: the Conductor OSS server boot JAR `3.32.0-rc.8` (Maven Central) and the released `agentspan-server-0.4.4.jar`
2121

22+
### Changed
23+
24+
- `useEnvVariables(true)` (and the `new ApiClient()` no-arg constructor) no longer throws when `CONDUCTOR_SERVER_URL` is unset — it falls back to `AGENTSPAN_SERVER_URL`, then `http://localhost:8080/api`; the resolved URL is normalized to end in `/api`, and credentials gain the `AGENTSPAN_AUTH_KEY`/`AGENTSPAN_AUTH_SECRET` fallback
25+
2226
## [5.1.0]
2327

2428
### Added

docs/agents/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ import org.conductoross.conductor.ai.AgentConfig;
8888
import org.conductoross.conductor.ai.AgentRuntime;
8989

9090
// Build the Conductor client (server URL + optional key/secret auth)…
91-
ApiClient client = AgentRuntime.client("http://localhost:8080", "my-key", "my-secret");
91+
ApiClient client = ApiClient.builder()
92+
.basePath("http://localhost:8080/api")
93+
.credentials("my-key", "my-secret")
94+
.build();
9295
// …and pass worker tuning (poll interval ms, worker threads).
9396
AgentRuntime runtime = new AgentRuntime(client, new AgentConfig(100, 5));
9497
```

docs/agents/agent-runtime-api.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,26 @@ fallbacks. Invalid or empty values fall back to the default.
7777

7878
---
7979

80-
## ApiClient factories
80+
## Building the ApiClient
8181

82-
Build an `ApiClient` to pass to the `AgentRuntime(ApiClient)` constructor. The `ApiClient` owns server URL, auth, and HTTP timeouts.
82+
Build an `ApiClient` (via its own builder — client construction lives in the client layer, not on the runtime) to pass to the `AgentRuntime(ApiClient)` constructor. The `ApiClient` owns server URL, auth, and HTTP timeouts.
8383

8484
```java
85-
// From environment (same as the no-arg constructor uses internally)
86-
ApiClient client = AgentRuntime.clientFromEnv();
85+
// From environment: CONDUCTOR_SERVER_URL → AGENTSPAN_SERVER_URL → http://localhost:8080/api
86+
// (same resolution the no-arg AgentRuntime() constructor uses internally)
87+
ApiClient client = ApiClient.builder().useEnvVariables(true).build();
8788

8889
// Unauthenticated — local dev
89-
ApiClient client = AgentRuntime.client("http://localhost:8080");
90+
ApiClient client = ApiClient.builder().basePath("http://localhost:8080/api").build();
9091

9192
// Key/secret auth
92-
ApiClient client = AgentRuntime.client("http://myserver:8080", "key", "secret");
93+
ApiClient client = ApiClient.builder()
94+
.basePath("http://myserver:8080/api")
95+
.credentials("key", "secret")
96+
.build();
9397
```
9498

95-
Default timeouts: `connectTimeout=10s`, `readTimeout=30s`, `writeTimeout=30s`. The `/api` base path is appended automatically.
99+
The no-arg `AgentRuntime()` constructor additionally applies `connectTimeout=10s`, `readTimeout=30s`, `writeTimeout=30s`. The env path normalizes the URL to end in `/api`; an explicit `basePath` is used as given.
96100

97101
---
98102

docs/agents/api-reference.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ The SDK entry point. Thread-safe — share one instance.
88

99
```java
1010
// Constructors
11-
AgentRuntime() // reads AGENTSPAN_* env vars
11+
AgentRuntime() // client + tuning from env vars
1212
AgentRuntime(AgentConfig config) // env vars + explicit tuning
1313
AgentRuntime(ApiClient client) // explicit client
1414
AgentRuntime(ApiClient client, AgentConfig config)
15-
16-
// Static factories for ApiClient
17-
static ApiClient clientFromEnv()
18-
static ApiClient client(String serverUrl)
19-
static ApiClient client(String serverUrl, String authKey, String authSecret)
2015
```
2116

17+
Build the `ApiClient` with its own builder (construction lives in the client
18+
layer): `ApiClient.builder().basePath("http://host:8080/api").credentials(key, secret).build()`,
19+
or `ApiClient.builder().useEnvVariables(true).build()` for the
20+
`CONDUCTOR_SERVER_URL``AGENTSPAN_SERVER_URL``http://localhost:8080/api` chain.
21+
2222
### Run
2323

2424
```java

docs/agents/getting-started.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@ import io.orkes.conductor.client.ApiClient;
4949
import org.conductoross.conductor.ai.AgentRuntime;
5050

5151
// No auth (local dev)
52-
ApiClient client = AgentRuntime.client("http://localhost:8080");
52+
ApiClient client = ApiClient.builder().basePath("http://localhost:8080/api").build();
5353

5454
// With key/secret
55-
ApiClient client = AgentRuntime.client("http://myserver:8080", "key", "secret");
55+
ApiClient client = ApiClient.builder()
56+
.basePath("http://myserver:8080/api")
57+
.credentials("key", "secret")
58+
.build();
5659

5760
AgentRuntime runtime = new AgentRuntime(client);
5861
```

docs/agents/spring-boot.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ public class MyAgentspanConfig {
125125

126126
@Bean
127127
public ApiClient agentspanClient() {
128-
return AgentRuntime.client("http://myserver:8080", "key", "secret");
128+
return ApiClient.builder()
129+
.basePath("http://myserver:8080/api")
130+
.credentials("key", "secret")
131+
.build();
129132
}
130133
}
131134
```

0 commit comments

Comments
 (0)