writeonce/docs/stories/jarvis/02-tool-use.md
shoney.arickathil 9d1689be55 docs(jarvis): create iteration stories 1 (ready) + 2/3 (refine)
- jarvis 1 (chat loop) brainstormed to ready with forks AUTO-APPROVED for
  autonomous execution and flagged in `review_pending` frontmatter for the
  developer's second review: Anthropic Messages API backend, env-var API key,
  actor-per-conversation SSE relay, durable @table history, session-gated routes
- jarvis 2 (tool use) + 3 (retrieval/RAG) created at refine with forks named
- 00-story iterations table linked to the new files
- blocked until rv2 9 TLS reaches phase F; pure .wo on porch 2/3/6/7 + the seam

(cherry picked from commit 8e160c3fcf9c50a05af073c036c693b192c9e595)
2026-09-15 01:15:31 +02:00

1.9 KiB

track iteration status readiness
jarvis 2 pending refine

jarvis 2 — tool use / the agent loop

Part of Story — jarvis, the writeonce AI assistant. Where the assistant becomes an agent: the model may call tools, and jarvis runs them and feeds results back until the model answers. Needs jarvis 1.

Why this exists

A chat loop answers from the model alone. An agent can act — read a file, query a @table, call a .wo function — by the model emitting a tool call, jarvis executing it, and returning the result for another turn. The actor model fits the multi-step orchestration naturally.

What it should deliver (to be refined)

  • A tool registry: named tools, each a .wo class with a typed input and a handler, satisfying a Tool interface structurally (the porch middleware precedent).
  • The agent loop: relay the tool-use request, dispatch to the tool actor, append the tool result, continue the turn — bounded to a max step count.
  • Tool-call framing in the backend adapter (the Messages API tool_use / tool_result blocks), isolated in the same adapter file jarvis 1 established.

Forks the brainstorm must settle

  1. Tool declaration shape — a .wo class + interface (no reflection, per principle 13) versus a declarative schema; and how the input JSON maps to a typed value without @derive (language 29).
  2. Sandboxing / permissions — which tools are allowed, and whether a tool that touches the filesystem or spawns a process (runtime-v2) needs an explicit grant.
  3. Step bound + loop safety — the max tool-call depth and how a runaway loop is stopped.

Out of scope

  • Retrieval (iteration 3); multi-model routing (later).

Info

Pure .wo on iteration 1. No new runtime primitive expected unless a tool needs one (each such tool names its own dependency).