Assembled from global_instruction (root only, deprecated) → static_instruction (cached) → instruction (main). Template variables {key} resolved from state.
Controlled by include_contents. "default" = full history (filtered, rearranged). "none" = current turn only (latest user input + active tool calls).
When .reads() or .context(C.from_state()) is set, state values are injected as a <conversation_context> block appended to the instruction.
For .ask("prompt"): the prompt string. For pipelines: ADK manages turn flow. Multi-agent: other agents' messages reformatted as "[agent_name] said: ..."
Function declarations for all registered tools. If output_schema is set on a model that doesn't natively support both, a set_model_response workaround tool is added.
If output_schema is set: response_schema + response_mime_type="application/json". LLM must respond with JSON matching the schema.
from adk_fluent import Agent, P, C, S reviewer = ( Agent("reviewer") .instruct( P.role("Senior code reviewer.") + P.task("Review for bugs.") + P.constraint("Be concise.") ) .context( C.window(n=5) + C.from_state("code") ) .writes("review") ) pipeline = ( Agent("parser").writes("parsed") >> S.pick("parsed") >> S.rename(parsed="code") >> reviewer >> S.pick("review") >> Agent("summarizer") .reads("review") )
── system_instruction ── Senior code reviewer. Task: Review for bugs. Constraints: Be concise. <conversation_context> code: [contents of state["code"]] [last 5 turn-pairs from history] </conversation_context> ── contents ── [current turn only — no full history] ── after response ── state["review"] = response_text
Run IR contract validation. Verify .produces()/.consumes() annotations match.
Pull out _context_spec, _prompt_spec, _output_schema from builder config. Strip internal _ fields.
C transforms compile first. Sets include_contents and creates the instruction provider (async callable). CWriteNotes extracted to after_agent_callback.
P transforms compile second. Can override the instruction from step 3. Static prompts become strings; dynamic prompts become async providers.
Final config dict passed to LlmAgent constructor. S transforms are wrapped as FnAgent pipeline steps separately.