Skip to content

Sub-Agent β€” Vision Sub-Call Over Cached Frames

Android Supported iOS Supported

sub_agent hands the frames captured by screenshot_sequence to a separate, stateless vision call and returns only its text answer. The images never enter the main agent’s context β€” you get β€œwhat happened in that animation?” answered without paying for the frames in your main conversation.

// 1. capture 2. ask
screenshot_sequence({"duration_seconds": 6, "fps": 2})
sub_agent({"task": "Did the video start playing? Describe the first 3 seconds."})

It reads the cached frames for the device (up to a hard ceiling of 60 frames, uniformly downsampled), runs one vision call, and returns the text.

The sub-call is a one-shot Anthropic vision request, so it needs an ANTHROPIC_API_KEY β€” it is not available under the claude-code subscription provider. It degrades gracefully: with no key set, sub_agent returns an explanatory message rather than raising, and the agent carries on.

Terminal window
export ANTHROPIC_API_KEY=sk-ant-... # enables sub_agent
export SUB_AGENT_MODEL=claude-sonnet-5 # optional model override (default)

Because it spawns a paid LLM call, sub_agent is EXEC_CAPABLE, not SAFE β€” it can’t be smuggled into a run_flow or chain batch, so an untrusted flow can’t fan out arbitrary billed vision calls.