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
docs(readme): rewrite docs for client-side APIs and simplify codebase (#24)
* docs(readme): rewrite docs for client-side APIs and simplify codebase
* docs(agents): add async client TODO to AGENTS.md
* ci(publish): add PyPI publish workflow and bump version to 0.1.1
* ci(publish): restrict build job to read-only permissions
* docs(readme): rewrite intro and section structure for clarity
* docs(readme): annotate architecture diagram with SDK component mappings
│ └── vllm_model.py # vLLMModel with token ID collection
74
72
├── examples/
75
73
│ ├── strands_math_agent/ # GSM8K example
76
74
│ │ ├── .bedrock_agentcore/ # Dockerfiles for deployment
@@ -160,15 +158,15 @@ agent = Agent(
160
158
161
159
162
160
@app.entrypoint
163
-
asyncdefinvoke_agent(payload):
161
+
definvoke_agent(payload):
164
162
"""
165
163
Invoke the agent with a payload
166
164
"""
167
165
user_input = payload.get("prompt")
168
166
169
167
print("User input:", user_input)
170
168
171
-
response =awaitagent.invoke_async(user_input)
169
+
response = agent(user_input)
172
170
173
171
return response.message["content"][0]["text"]
174
172
@@ -199,12 +197,14 @@ Since the client won't get results directly from HTTP:
199
197
- Client polls S3 using efficient HEAD requests to detect when each result is available
200
198
- No additional messaging infrastructure required — S3 is the single source of truth
201
199
200
+
On the client side, `RolloutClient` and `RolloutFuture` are the complement to these server-side patterns — they handle submitting requests to ACR and polling S3 for results, so both sides work together to manage long-running async agent tasks end-to-end. See the [Evaluation](#evaluation) section for details.
**RolloutClient** (`src/agentcore_rl_toolkit/client.py`) provides two invocation patterns:
308
+
-**`invoke()`**: Returns a `RolloutFuture` for fine-grained control — ideal for training loops (e.g., GRPO) where you submit individual rollouts and group results by `input_id`
309
+
-**`run_batch()`**: Higher-level API for batch evaluation — manages concurrency, timeouts, and polling automatically
310
+
311
+
Concretely, `invoke()` sends the request to ACR and returns a `RolloutFuture` immediately — meaning ACR has received the request and a background agent session is processing it. Calling `future.result(timeout=...)` blocks until the result appears in S3, polling with exponential backoff. It returns the complete rollout data (token IDs, rewards, etc.) once the agent finishes and writes to S3.
312
+
313
+
Both patterns share the same infrastructure:
306
314
-**Rate limiting**: Handles ACR TPS limits (25)
307
315
-**Concurrency control**: Manages ACR session limits (1000/account) and model API rate limits
308
316
-**S3 HEAD polling**: Polls S3 for completed results using efficient HEAD requests
@@ -339,9 +347,8 @@ See `.env.example` for template. The build script sources `.env` for deployment
3. Implement rollout collector appropriate for the framework
344
-
4. Export in `src/agentcore_rl_toolkit/__init__.py`
350
+
2. Implement framework-specific model or utility (e.g., `vLLMModel` for Strands) that collects token IDs and rollout data
351
+
3. Export in the framework's `__init__.py`
345
352
346
353
### Running Tests
347
354
@@ -426,15 +433,9 @@ uv run pre-commit install
426
433
427
434
## Known Limitations & TODOs
428
435
429
-
### Testing & CI
430
-
- Limited test coverage (expansion planned)
431
-
- No CI/CD pipeline yet (planned)
432
-
433
436
### Design Improvements
434
-
-**Model creation**: `vLLMModel` is currently under `frameworks/strands/` but is largely framework-agnostic; may be moved to a shared location
435
-
436
-
### Dependency Updates
437
-
-**bedrock-agentcore-starter-toolkit**: Needs upgrade to latest version for better Docker utilities and local testing support
437
+
-**Model gateway**: `vLLMModel` is currently framework specific under `frameworks/strands/`. In the future, we want to eliminate the need for a customized model to collect token ids. Instead, a gateway server will be used to direct model inference calls, automatically intercept the token ids, and persist to databases so that users don't have to manually collect them. This will also better reveal the status of a rollout session and preserve partial rollouts.
438
+
-**Async client**: `RolloutClient` and `RolloutFuture` are currently synchronous (blocking). We plan to add async-compatible versions so they can be used natively in `asyncio` event loops.
0 commit comments