feat(agent): durable workflows, handoffs, response caching, multimodal tool output#38
Merged
Merged
Conversation
…l tool output Add four backward-compatible capabilities to the agent SDK (default behavior unchanged; all covered by tests, race-clean): - DBOS durable workflows: types.StepRunner seam (NoopStepRunner default) + Agent.RunDurable + agent/durable/dbos engine (gob serializer, shared pgx pool, idempotency, recovery). LLM and tool calls become memoized durable steps. - Agent handoffs via a stable root: WithHandoffs, HandoffContent/HandoffDelta, shared-tree control transfer with per-iteration provider/tools/persona swap and a MaxHandoffs bound. - Response caching: types.Cache[V] + agent/cache/memcache LRU+TTL + agent/provider/cache decorator (deterministic key, stream record/replay, UsageDelta.CacheHit). - Multi-modal tool output: types.RichTool/ToolResult/ToolResultBlock; Anthropic emits real image/PDF/text tool_result blocks; OpenAI/Google project to text plus image follow-ups. Also: mid-stream provider errors now fail the turn instead of being swallowed, multi-part UsageDelta token accounting is merged, plus examples and AGENTS.md.
This was referenced May 31, 2026
Closed
Closed
…et + go vulns - Extract appendInput/resolveActive/assistantToolCalls/persistToolResults/ applyHandoff helpers from runLoop so its cyclomatic complexity drops from 33 to ~15 (gocyclo threshold is 30). Behavior unchanged; all tests pass. - Bump golang.org/x/net 0.52.0 -> 0.55.0 (GO-2026-4918 HTTP/2 loop + x/net/html XSS advisories) and go directive 1.25.9 -> 1.25.10 (net/http stdlib fix). govulncheck ./... now reports 0 affecting vulnerabilities.
bd351ca to
3a059cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Foundation PR — base for the wave PRs
Adds four backward-compatible capabilities to the agent SDK. Default behavior is unchanged (NoopStepRunner, no handoffs, no cache, plain tools = the old path), all existing tests pass, and the new code is race-clean.
Features
types.StepRunnerseam (no-op default) +Agent.RunDurable+agent/durable/dbosengine (gob serializer, shared pgx pool, idempotency, recovery). LLM and tool calls become memoized durable steps.WithHandoffs,HandoffContent/HandoffDelta, shared-tree control transfer with per-iteration provider/tools/persona swap,MaxHandoffsbound.types.Cache[V]+agent/cache/memcache(LRU+TTL) +agent/provider/cachedecorator (deterministic request hash, stream record/replay,UsageDelta.CacheHit).types.RichTool/ToolResult/ToolResultBlock; Anthropic emits real image/PDF/texttool_resultblocks; OpenAI/Google project to text + image follow-ups.Also fixed (from an adversarial review of this diff)
Corrupt tool_result on marker-cancel, gob panic on nested tool args, DBOS step-ID race (tools run sequentially under a durable runner), Google dropping rich blocks on the system path, OpenAI image-follow-up breaking tool-message contiguity, handoff off-by-one + guard-before-persist, mid-stream provider errors swallowed, and multi-part
UsageDeltatoken accounting.Merge order
This is the base for the Wave 1–5 PRs (correctness floor, durability spine, isolation/security, temporal differentiators, GA hardening). Merge this first; the wave branches are stacked on it.