Skip to content

Commit abfc28d

Browse files
committed
docs: update README for v2.4.0 — add generate_object and structured output
- Add generate_object to core tools table - Add Structured Output design principle section (§5) - Update documentation links to a3s-lab.github.io - Add Tutorials link Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 09bea08 commit abfc28d

1 file changed

Lines changed: 50 additions & 14 deletions

File tree

README.md

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ Default core tools:
147147
| Programmatic | `program` |
148148
| Delegation | `task`, `parallel_task` |
149149
| Skills | `search_skills`, `Skill` |
150+
| Structured Output | `generate_object` |
150151

151152
Intent-gated tools:
152153

@@ -193,7 +194,41 @@ script can call every registered tool except `program`; use `allowedTools` or
193194
structured summaries, findings, artifact references, and suggested next actions.
194195
Raw output belongs in trace storage.
195196

196-
### 5. Runtime Observability Is A Contract
197+
### 5. Structured Output
198+
199+
When the agent needs to produce machine-readable results, `generate_object`
200+
forces schema-validated JSON output from any LLM provider:
201+
202+
```typescript
203+
const result = await session.tool('generate_object', {
204+
schema: {
205+
type: 'object',
206+
required: ['sentiment', 'confidence'],
207+
properties: {
208+
sentiment: { type: 'string', enum: ['positive', 'negative', 'neutral'] },
209+
confidence: { type: 'number', minimum: 0, maximum: 1 },
210+
},
211+
},
212+
prompt: 'Classify: "This product is amazing!"',
213+
schema_name: 'sentiment',
214+
});
215+
216+
const { object } = JSON.parse(result.output);
217+
// { sentiment: "positive", confidence: 0.95 }
218+
```
219+
220+
The tool works in two modes:
221+
- **Agent-driven**: The LLM sees `generate_object` in its tool list and calls it
222+
autonomously when structured output is needed.
223+
- **Direct call**: `session.tool('generate_object', ...)` bypasses LLM decision-making
224+
for deterministic structured extraction.
225+
226+
Reliability comes from three layers: tool-call mode forces the LLM to produce
227+
JSON as tool arguments, a built-in schema validator catches violations, and an
228+
automatic repair loop feeds errors back to the model (up to `max_repair_attempts`
229+
retries). Streaming mode emits partial objects as `tool_output_delta` events.
230+
231+
### 6. Runtime Observability Is A Contract
197232

198233
Product UIs and harnesses should build from typed runtime state rather than
199234
parsing final answer text. Every `send(...)` or `stream(...)` creates run-scoped
@@ -281,7 +316,7 @@ if latest:
281316
session.cancel_run(latest["id"])
282317
```
283318

284-
### 6. AHP-Supervised Background Advice
319+
### 7. AHP-Supervised Background Advice
285320

286321
A3S Code keeps the core session runtime focused on the main agent. Background
287322
advice, context supplements, and proposed PTC scripts are caller-owned AHP
@@ -312,7 +347,7 @@ advice through the host UI or by explicitly calling session APIs. Proposed PTC
312347
scripts remain proposals until the caller runs them through the normal
313348
`program`, permission, confirmation, and trace paths.
314349

315-
### 7. Delegated Tasks Isolate Context
350+
### 8. Delegated Tasks Isolate Context
316351

317352
Delegated tasks are not there to create more chat. They isolate local work.
318353

@@ -335,7 +370,7 @@ Delegated child runs should return:
335370

336371
The parent should not ingest the full child transcript.
337372

338-
### 8. Safety Has One Gate
373+
### 9. Safety Has One Gate
339374

340375
All side effects should pass through one authorization path.
341376

@@ -347,7 +382,7 @@ Allow | Ask | Deny
347382

348383
This keeps `bash`, writes, network calls, MCP calls, and release actions auditable.
349384

350-
### 9. Completion Requires Verification
385+
### 10. Completion Requires Verification
351386

352387
A coding agent is not done because it produced text. It is done when the goal is satisfied and the result has been checked.
353388

@@ -657,17 +692,18 @@ cargo build -p a3s-code-node
657692

658693
## Documentation
659694

660-
Full reference and guides: [a3s.dev/docs/code](https://a3s.dev/docs/code)
695+
Full reference and guides: [a3s-lab.github.io/a3s/docs/code](https://a3s-lab.github.io/a3s/docs/code)
661696

662697
- [SDK API Design Contract](manual/SDK_API_DESIGN.md)
663-
- [Sessions](https://a3s.dev/docs/code/sessions)
664-
- [AHP Protocol](https://a3s.dev/docs/code/ahp)
665-
- [Tools](https://a3s.dev/docs/code/tools)
666-
- [Skills](https://a3s.dev/docs/code/skills)
667-
- [Memory](https://a3s.dev/docs/code/memory)
668-
- [Security](https://a3s.dev/docs/code/security)
669-
- [Hooks](https://a3s.dev/docs/code/hooks)
670-
- [Examples](https://a3s.dev/docs/code/examples)
698+
- [Sessions](https://a3s-lab.github.io/a3s/docs/code/sessions)
699+
- [Tools & Structured Output](https://a3s-lab.github.io/a3s/docs/code/tools)
700+
- [AHP Protocol](https://a3s-lab.github.io/a3s/docs/code/ahp-integration)
701+
- [Skills](https://a3s-lab.github.io/a3s/docs/code/skills)
702+
- [Memory](https://a3s-lab.github.io/a3s/docs/code/memory)
703+
- [Security](https://a3s-lab.github.io/a3s/docs/code/security)
704+
- [Hooks](https://a3s-lab.github.io/a3s/docs/code/hooks)
705+
- [Examples](https://a3s-lab.github.io/a3s/docs/code/examples)
706+
- [Tutorials](https://a3s-lab.github.io/a3s/tutorials)
671707

672708
---
673709

0 commit comments

Comments
 (0)