Polka Docs

The harness

The harness owns a turn: it asks the model, runs the tool calls it makes, gives the results back, and goes again until the model answers. Everything around that loop is a part you choose. Each part is a crate of the ADK.

The parts

Crate What it gives the harness
harness the loop and its controls: steps, retries, hooks, compaction, sub-agents, parallel tool calls, approvals, tools hidden until the model looks for them, the prompt, the session log
gateway the model: the platform's gateway with one Polka key, or your own OpenAI, Anthropic, Gemini or OpenAI-compatible key
sandbox the hands: commands and files under one root, confined on this machine or a container on the edge
door the sandbox's only way out: the hosts it may reach, with credentials added by name, every decision recorded
tools bash, read, write, edit on any sandbox; plan; memory
skills folders with a SKILL.md, listed in the prompt and loaded with one tool
mcp MCP servers, each of their tools a harness tool
evals cases and checks run on a fresh agent each time, and a report
runtime Setup, and the wire a front talks to the agent over
front the terminal, or the wire on a WebSocket for a page of your own
voice talking by voice: heard and spoken through the gateway, a sentence at a time
tasks a fast talker with the work in background tasks it starts, checks, steers and stops

The prompt

A Prompt is made of named sections, so each one can be swapped, tested and kept apart:

let prompt = Prompt::new()
    .text(WHO)
    .section("Environment", setup.environment());

Tools

tools::all(sandbox) gives bash, read, write and edit, all confined to the sandbox. Every tool is behind one interface, so a tool of your own, an MCP server's tools and a sub-agent all look the same to the model.

Memory and planning are tools

Memory (tools::Memory, notes kept in a sandbox of their own) and planning (tools::Plan) are tools the model calls, not parts of the loop. An agent that doesn't need them doesn't carry them.

Sub-agents

A harness can be offered to another as a tool. The helper gets a conversation of its own, works on one piece, and only its answer comes back. Several can run at once. polka run --subagents shows it on a single task; examples/help-desk hands the separate parts of a question to a researcher, three at a time.

Approvals and hooks

A tool call can ask a person first: once, always for that tool, or by waiting for someone to decide later and then resuming. A hook sees each call before it runs and can refuse it: examples/help-desk lets bash only look, never change.

The session log

The log is append-only and it is the truth of what the model saw. A conversation is replayed from it, resumed with --resume, or forked from any point with --fork. On the edge, the conversation's room keeps the log and hands it back on each turn.

Examples to read

Example What it shows
examples/runner the smallest agent, in the terminal, on the edge or on a host
examples/help-desk a support agent: docs, skills, memory, a hook, an approval, a helper, a web page as its front
examples/coder a coding agent
examples/researcher a helper other agents hand work to
examples/voice-desk talking by voice while work runs in background tasks

Edit this page on GitHub