Skip to content

feat(agent): durable workflows, handoffs, response caching, multimodal tool output#38

Merged
urmzd merged 3 commits into
mainfrom
feat/agent-durable-handoffs-caching-multimodal
May 31, 2026
Merged

feat(agent): durable workflows, handoffs, response caching, multimodal tool output#38
urmzd merged 3 commits into
mainfrom
feat/agent-durable-handoffs-caching-multimodal

Conversation

@urmzd

@urmzd urmzd commented May 31, 2026

Copy link
Copy Markdown
Owner

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

  • DBOS durable workflowstypes.StepRunner seam (no-op 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 rootWithHandoffs, HandoffContent/HandoffDelta, shared-tree control transfer with per-iteration provider/tools/persona swap, MaxHandoffs bound.
  • Response cachingtypes.Cache[V] + agent/cache/memcache (LRU+TTL) + agent/provider/cache decorator (deterministic request hash, stream record/replay, UsageDelta.CacheHit).
  • Multi-modal tool outputtypes.RichTool/ToolResult/ToolResultBlock; Anthropic emits real image/PDF/text tool_result blocks; 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 UsageDelta token 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.

…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.
urmzd added 2 commits May 31, 2026 15:21
…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.
@urmzd urmzd force-pushed the feat/agent-durable-handoffs-caching-multimodal branch from bd351ca to 3a059cb Compare May 31, 2026 20:48
@urmzd urmzd merged commit 6813d99 into main May 31, 2026
6 checks passed
@urmzd urmzd deleted the feat/agent-durable-handoffs-caching-multimodal branch May 31, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant