You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5b36ceb
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ First stable release of the Java SDK for the Forward API, using `com.qoder.sdk:q
12
12
- Shared PAT, static SAT and custom credentials, plus `ServiceAccountCredential` for automatic SA Key exchange, SAT caching and refresh. Forward administrator/Identity SAT issuance and revocation use explicit per-call SA Keys.
13
13
- Typed Forward resource APIs for Models, Templates, Identities and configuration, Sessions and Threads, Memory Stores, Environments, Files, Skills, Vaults and Credentials, Schedules, Batches, Channels and Pairing, Usage and Drive.
14
14
- Session/Thread SSE subscriptions with cancellation and explicit resumption; Realtime conversations with text/PCM audio, typed events, acknowledged close and History.
15
-
- Shared request options, timeouts, retries, pagination, response metadata and typed errors, with resource-lifecycle examples and API guides. Managed APIs are outside this release's scope.
15
+
- Shared request options, timeouts, retries, pagination, response metadata and typed errors, with resource-lifecycle examples and API guides. Managed API support is planned for a future release and is not included in 0.1.0.
Java 8+ SDK for the **Forward API**, with typed synchronous and asynchronous clients. Supports PAT/SA authentication, pagination, retries, Session/Thread SSE and Realtime text/audio. Managed APIs are outside this SDK's scope.
The Qoder Cloud Agents Java SDK provides typed synchronous and asynchronous clients, with shared authentication, timeouts, retries, pagination, streaming and error handling.
6
+
7
+
Version **0.1.0** supports the **Forward API**. **Managed API support is planned for a future release** and is not available in this version.
8
+
9
+
| Capability | Resources |
10
+
| --- | --- |
11
+
| Agent configuration | Template, Identity and per-Identity configuration |
12
+
| Conversations | Session, Thread, event history and SSE subscriptions |
for (Model model : client.models().list().data()) {
63
+
if (model.isEnabled()) {
64
+
System.out.println(model.id());
65
+
}
66
+
}
67
+
}
68
+
}
32
69
}
33
70
```
34
71
35
-
The default endpoint is Global: `https://api.qoder.com/api/v1/forward`. For CN, add `.baseUrl("https://api.qoder.com.cn/api/v1/forward")` to the client builder.
72
+
| Region | Forward BaseURL |
73
+
| --- | --- |
74
+
| Global (default) |`https://api.qoder.com/api/v1/forward`|
75
+
| CN |`https://api.qoder.com.cn/api/v1/forward`|
76
+
77
+
For CN, add `.baseUrl("https://api.qoder.com.cn/api/v1/forward")` to the builder. If omitted, the SDK reads `QODER_FORWARD_BASE_URL`, then uses Global. BaseURLs include the full API root path.
78
+
79
+
Clients are thread-safe and can be reused. Close the owning client when your application finishes using it. The following snippets assume an open `client`; replace resource IDs with IDs accessible to your credential.
36
80
37
-
## Service Account
81
+
## PAT and Service Account authentication
38
82
39
-
Set `QODER_SA_KEY` and explicitly configure a credential:
83
+
PAT and SA are parallel authentication modes:
84
+
85
+
| Mode | Configuration | Token renewal |
86
+
| --- | --- | --- |
87
+
| PAT |`.pat(token)`| Managed by your application |
88
+
| SA Key |`.credential(ServiceAccountCredential)`| SDK exchanges, caches and refreshes the SAT on demand |
89
+
| Existing SAT |`.authMode(AuthMode.SA).accessToken(token)`| Managed by your application |
90
+
91
+
With no explicit credentials, PAT mode reads `QODER_ACCESS_TOKEN`, then `QODER_PAT`. An explicit token or credential takes precedence over environment tokens; configure only one explicit source. The SDK does not load `.env` files or enable SA merely because `QODER_SA_KEY` is set.
92
+
93
+
To use automatic SA exchange, set `QODER_SA_KEY` and configure a credential:
The credential exchanges the SA Key for a SAT, then caches and refreshes it. For CN, use both `Region.CN` and the CN BaseURL. See [client configuration](docs/client-configuration.md) for static SATs, authentication precedence, timeouts, retries and cancellation.
110
+
Business requests use the SAT; the SA Key is sent only to the exchange service. For CN, use both `Region.CN` and the CN BaseURL. Keep a shared credential open until all clients using it are closed. Failed SA authentication does not fall back to PAT.
111
+
112
+
Forward also provides explicit administrator/Identity SAT issuance and revocation through `serviceAccountTokens()` and `identities().serviceAccountTokens()`. These methods take a per-call SA Key and do not retry automatically. See [SAT management](docs/usage-sat-drive.md) and [authentication configuration](docs/client-configuration.md).
113
+
114
+
## Conversations and streaming
115
+
116
+
Create a Session using an existing Identity and Template, send a user message, and consume events through SSE:
if ("session.status_idle".equals(event.type())) break;
154
+
}
155
+
}
156
+
```
157
+
158
+
Reuse an idempotency key when retrying the same logical write. A successful send acknowledges input, not completed execution. An idle event can mean the turn finished or paused for input; inspect the event's stop reason in your application. The example bounds the subscription to five minutes; closing it does not cancel or archive the Session.
159
+
160
+
Thread subscriptions use `sessions().threads().events()`. For explicit reconnects with the last delivered SSE ID, use `resumableStream(...)`; user messages are not automatically resent. See [Session operations](docs/sessions.md), [streaming and cancellation](docs/session-streaming.md) and the [runnable streaming example](examples/src/main/java/com/qoder/cloudagents/examples/SessionStreamingExample.java).
161
+
162
+
## Asynchronous calls and cancellation
163
+
164
+
The async view shares the client's authentication and transport:
// When the result is no longer needed: pending.cancel(true);
173
+
```
174
+
175
+
Keep the owning client open until requests complete. Cancel the SDK-returned future to stop its HTTP request and retry timer. `ForwardClient.builder().buildAsync()` creates an independently owned `AsyncForwardClient`. Cancelling a request locally does not invoke `sessions().cancel(...)` on the server. See [async ownership and cancellation](docs/client-configuration.md#asynchronous-calls-and-cancellation).
176
+
177
+
## Pagination
178
+
179
+
List responses support one-page access and lazy iteration:
for (com.qoder.cloudagents.forward.Template template : page) {
187
+
System.out.println(template.id()); // Fetches subsequent pages as needed.
188
+
}
189
+
```
190
+
191
+
Use `page.data()` for only the current page, or `hasNextPage()` and `getNextPage()` / `getNextPageAsync()` for manual pagination. Filters, request options and server order are preserved. Drive uses `entries` / `next_page_token`; Realtime History has its own `next_before` cursor. See the [resource guides](docs/forward-api-coverage.md#使用指南) for those APIs.
192
+
193
+
## Timeouts, retries and errors
194
+
195
+
Pass `RequestOptions` as the last argument to customize a request:
-**Timeouts:** the connection timeout defaults to 5 seconds; response-header and read/write idle timeouts default to 10 minutes. `timeout` adjusts per-attempt header/idle limits; `totalTimeout` bounds the whole request, including credentials and retries. SSE has separate read-lifecycle rules.
214
+
-**Retries:** at most 2 retries by default, subject to method safety, body replayability and server hints. HTTP 409 is never retried; non-idempotent writes only qualify for 429 retries. An idempotency key permits other eligible write retries.
215
+
-**Errors:**`ApiException` is the request-error base type. HTTP failures expose status and request ID through `ApiStatusException`; connection, timeout, cancellation and response-validation failures have distinct types.
216
+
-**Responses:** models expose `requestId()` and unknown JSON fields via `field(name)`. Use `withResponse()` for HTTP status and headers. Request builders distinguish omitted fields from explicit `null`.
217
+
218
+
See [client configuration](docs/client-configuration.md) for detailed defaults and [Template configuration](docs/templates.md) for typed configuration and field semantics.
219
+
220
+
## Realtime
221
+
222
+
Realtime (Beta) supports conversation creation, text and PCM audio exchange over WebSocket, Work events and persisted History. Use `client.realtime().conversations()` for creation/history and `client.realtime().connect(...)` for connections. The Template must have Realtime enabled and be accessible to the credential.
223
+
224
+
Microphone capture and audio playback belong to the application. Connections do not automatically reconnect or replay input. See the [Realtime guide](docs/realtime.md) and [runnable example](examples/src/main/java/com/qoder/cloudagents/examples/RealtimeExample.java) for authentication, audio formats and connection lifecycle.
-[API coverage](docs/forward-api-coverage.md): supported operations and guides for each resource.
230
+
-[Files and downloads](docs/environments-files.md) and [Drive, Usage and SAT management](docs/usage-sat-drive.md).
231
+
-[Live testing](docs/live-testing.md): opt-in CN/Global verification and coverage boundaries.
232
+
233
+
## Development
234
+
235
+
With JDK 17+ and Python 3 installed, run from the repository root:
236
+
237
+
```sh
238
+
make quality
239
+
make test
240
+
```
241
+
242
+
These commands check formatting, documentation and maintenance scripts, then build the SDK and test the packaged JAR through the independent examples project. Default tests use local mock services. See [CONTRIBUTING.md](CONTRIBUTING.md), [maintenance](docs/maintaining.md) and [releasing](docs/releasing.md).
243
+
244
+
## Versioning
57
245
58
-
## Documentation
246
+
Pin the SDK version in your build. Before 1.0, incompatible API changes use a new minor version and include migration notes. See the [changelog](CHANGELOG.md) for upgrading from the RC or earlier internal coordinates.
59
247
60
-
-[Runnable resource examples and shared authentication setup](examples/README.md)
61
-
-[Forward API coverage and resource guides](docs/forward-api-coverage.md)
62
-
-[Session/Thread SSE](docs/session-streaming.md) and [Realtime text, audio and History](docs/realtime.md)
63
-
-[Usage, Forward SAT management and Drive](docs/usage-sat-drive.md)
64
-
-[Live testing](docs/live-testing.md)
248
+
## License
65
249
66
-
For source builds and contributions, see [CONTRIBUTING.md](CONTRIBUTING.md). Maintainers can follow the [maintenance](docs/maintaining.md) and [release](docs/releasing.md) guides.
0 commit comments