Repository navigation
docs(examples): add subagents and AG-UI runnable examples - #1895
Conversation
|
@infer if you need to provide an example please write it in go. |
|
Model: Todos
Pull Request✅ Infer Result: SuccessMemory updated. Closing out the todos: Done. The example code is now in Go, per your ask - the Python consumer is gone. What changed
Validation
Skipped/risks: the README's "What to expect" sample still shows streamed text as single chunks (mock chunking can split lines like Model: Tokens: 4,044,723 in · 43,852 out · 4,088,575 total (59 requests) Tool calls: 62 total · 100% success rate TracesStatsTriggered by edenreich · Infer Action · OSS |
|
@infer there is a merge conflict, can you resolve this? |
|
Model: Todos
Pull Request✅ Infer Result: SuccessMerge conflict resolved and pushed - GitHub now reports PR #1895 as What the conflict wasOnly How I resolved it
The conflicted table now carries both sides: Verification
Heads up: resolving this rewrote the branch history (no merge commit was added - the three commits were re-parented onto main), so anyone with a local checkout of Skipped re-running the example demos end to end (content is byte-identical to the already-validated version) and a full Model: Tokens: 2,200,477 in · 30,687 out · 2,231,164 total (41 requests) Tool calls: 40 total · 100% success rate TracesStatsTriggered by edenreich · Infer Action · OSS |
Ported consume.py to a stdlib-only examples/ag-ui/main.go with the same printed lines and the same stdin frame protocol, driven via go run . stream | serve [--approval], so the example needs a Go toolchain instead of python3.
2b4b6bf to
e04ad86
Compare
|
🎉 This PR is included in version 0.263.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Resolves #1891
Summary
Adds the two runnable examples the issue asks for:
examples/subagentsshows theAgenttool fanning out two tasks (one naming a Markdown-defined agent throughagent) and folding both results back into one tool result, andexamples/ag-uiconsumes the AG-UI headless stream and the--serveworker with a small Go program. Both run offline against the tokenless mock likeexamples/tools- no API key, no gateway. Per maintainer feedback the ag-ui consumer is written in Go, not Python, so nopython3is needed.Changes
examples/subagents/(README.md, Taskfile.yml, scenarios.yaml,.agents/agents/researcher.md): a Markdown agent preset withname,description, atools: [Read, Grep]allowlist,model: inheritand a system-prompt body;task listrunsinfer agents list;task fanout(in--mode auto) callsAgentwith twotasks- one throughagent: researcher, one plain;task fanout:nameshows thedescriptionshorthand; Taskfile setsINFER_TOOLS_AGENT_WAIT=truefor the deterministic fan-in. The README documents the knobs the run depends on:tools.agent.max_parallel,max_depth,idle_timeout,inherit_mock,wait,mode, andtask chat.examples/ag-ui/(README.md, Taskfile.yml, scenarios.yaml, main.go): a stdlib-only Go program,go run . stream | serve [--approval];task streampipesinfer headless --format ag-ui --no-savethrough the program, printingRUN_STARTED,TOOL_CALL_START,TOOL_CALL_RESULT,TEXT_MESSAGE_CONTENTandRUN_FINISHEDwith each row mapped to a section ofdocs/ag-ui-output.md;task servespawnsinfer headless --serve --session-id ag-ui-serve-demo, writes tworun_agent_inputframes to stdin (one AG-UI run per frame) and closes stdin to shut the worker down;task serve:approvaldoes the same with--require-approvaland answers oneinterruptover stdin with aresumeframe.docs/examples.md: indexes both examples in the runnable examples table.Validation
task list,task fanout,task fanout:nameinexamples/subagents;task stream,task serve,task serve:approvalinexamples/ag-ui. The approval variant suspends on theWritecall withRUN_FINISHED interruptand completes after theresumeanswer, exactly asdocs/ag-ui-output.mddocuments.task stream,task serveandtask serve:approvalafter the Python-to-Go port with identical output, andgo vetplusgolangci-lint(0 issues) onexamples/ag-ui.markdownlintclean on both READMEs and ondocs/examples.md; the pre-commit gate (mod:tidy, fmt, lint:imports, golangci-lint, markdownlint) passed on commit.INFER_AGENT_MODELandINFER_TOOLS_*_REQUIRE_APPROVAL, so the offline validation shim set the mock model and restored approval defaults explicitly; shipped example files carry no such overrides.no docs ticket: examples and their docs live in this repo and are indexed by docs/examples.md
Docs mirror ticket: inference-gateway/docs#1255