Managing Agent Identity and Persona Constraints in ADK
How ADK's LlmAgent name, description, instruction, and schema fields define agent identity, persona, and hard behavioral constraints — and where each boundary sits.
Published on • November 24, 2026
AI Assistant

Every ADK agent answers three questions before it ever generates a token: what am I (name, description, model), how do I behave (instruction), and what am I forbidden from doing (constraints encoded in the instruction, schemas, and context flags). Getting these fields right is the difference between a routed multi-agent system that works and one that hallucinates its own boundaries.
This article walks through the identity and persona surface of LlmAgent as documented on adk.dev, and shows where hard constraints belong versus soft style guidance.
Identity fields: name, description, model
The identity block is small but load-bearing:
name(required): A unique string identifier used internally, especially when agents refer to or delegate to each other. In Python it must be a valid Python identifier, and ADK rejects the reserved nameuser.description(optional, recommended for multi-agent): A summary other LLM agents read to decide whether to route a task here. Be specific — “Handles inquiries about current billing statements” beats “Billing agent”.model(optional in Python): A string like"gemini-flash-latest"or aBaseLlminstance. Omitted, the agent inherits the model of its nearestLlmAgentancestor, skipping non-LlmAgentparents such asSequentialAgentorParallelAgent, and falls back to ADK’s built-in default otherwise.
from google.adk.agents import LlmAgent
billing_router = LlmAgent(
name="billing_inquiry_agent",
model="gemini-flash-latest",
description="Handles inquiries about current billing statements and invoices.",
instruction="You route billing questions to the right sub-agent.",
sub_agents=[invoice_agent, refund_agent],
)
The description is not decoration: in a hierarchy it is the routing contract. The docs explicitly recommend descriptions that differentiate an agent from its peers, because the parent LLM reads them to pick a target.
Persona lives in instruction
The instruction parameter is, in the docs’ own words, “arguably the most critical for shaping an LlmAgent’s behavior.” It is a string (or a function returning a string) that defines:
- The core task or goal.
- Personality or persona — “You are a helpful assistant,” “You are a witty pirate.”
- Constraints on behavior — “Only answer questions about X,” “Never reveal Y.”
- How and when to use each tool, supplementing the descriptions already on the tools themselves.
- Desired output format — JSON, bulleted lists, fixed lengths.
Their tips for effective instructions: be clear and specific, use Markdown for readability, provide few-shot examples for complex formats, and explain when and why to call each tool rather than just listing them.
support_agent = LlmAgent(
name="support_agent",
model="gemini-flash-latest",
instruction="""You are Acme's front-line support agent.
# Persona
Calm, concise, and never defensive. You speak plain English.
# Constraints
- Answer ONLY questions about orders, shipping, and returns.
- Never reveal internal ticket IDs or employee names.
- If the user asks for anything else, reply: "I'll pass you to the right team."
# Tools
Use `lookup_order` for any order status question; call it once per order ID.
""",
tools=[lookup_order],
)
For rules that must apply to every agent in a system, the docs point to GlobalInstructionPlugin rather than the deprecated global_instruction parameter (ADK Go exposes GlobalInstruction / GlobalInstructionProvider on llmagent.Config).
Hard constraints: schemas and context flags
Persona text is soft — the model can drift. ADK gives you three harder levers:
1. output_schema + output_key. If set, the agent’s final response must be a JSON string conforming to the schema; a Pydantic model, list[str]-style lists, dict, or google.genai.types.Schema all work in Python. The parsed result lands in session.state[output_key]. In Python, output_schema and tools can coexist: tools stay available while the agent works and the schema applies only to the final response (models that can’t combine them natively get a set_model_response tool injected).
from pydantic import BaseModel, Field
class CapitalOutput(BaseModel):
capital: str = Field(description="The capital of the country.")
structured_agent = LlmAgent(
name="structured_capital_agent",
model="gemini-flash-latest",
instruction='Respond ONLY with a JSON object: {"capital": "capital_name"}',
output_schema=CapitalOutput,
output_key="found_capital",
)
2. include_contents='none'. The default 'default' sends relevant conversation history; 'none' strips prior contents entirely so the agent operates only on its instruction and the current turn — a structural constraint against leakage from earlier turns.
3. generate_content_config. Tune temperature, max_output_tokens, top_p, top_k, and safety settings via google.genai.types.GenerateContentConfig. One documented pitfall: in Python, ADK raises a ValueError if this config sets tools, system_instruction, response_schema, or http_options.base_url — route those through the agent’s tools, instruction, and output_schema fields instead.
Combining two of these levers produces a tight, stateless classifier whose behavior is constrained structurally rather than by prose:
from google.genai import types
guardrailed_agent = LlmAgent(
name="stateless_classifier",
model="gemini-flash-latest",
include_contents='none', # ignore prior turns entirely
instruction="Classify the CURRENT user message only into: billing, shipping, other.",
generate_content_config=types.GenerateContentConfig(
temperature=0.2, # more deterministic output
max_output_tokens=250, # cap the response
),
)
| Constraint lever | Enforced by | Strength |
|---|---|---|
instruction persona/scope text | The model, via prompt | Soft — drifts with long contexts |
output_schema | ADK validation of the final response | Hard — malformed JSON rejected |
include_contents='none' | ADK request construction | Hard — history never sent |
generate_content_config | GenAI API parameters | Hard — sampling and length bounds |
| Safety settings in config | Gemini API | Hard — content blocked upstream |
Identity in multi-agent systems
When agents delegate, identity choices have failure modes of their own. Names must be unique and descriptive (customer_support_router vs agent_1), because transfer_to_agent and sub-agent routing key off them. A vague description causes misrouting; an over-broad instruction causes a specialist to answer questions it should hand off. Keep persona (tone, phrasing) separate from scope (which questions belong to this agent), and validate scope with evals before tightening prompt language further — related coverage lives in context-engineering-managing-what-agent-sees.md.
| Symptom in a multi-agent system | Likely identity bug | Fix |
|---|---|---|
| Router picks the wrong specialist | Vague, near-identical descriptions | Make each description differentiate its peers |
| Specialist answers out-of-scope questions | Persona and scope mixed in instruction | Split scope rules into their own section |
| Sub-agent repeats stale conversation | Default include_contents on a worker | Set include_contents='none' for stateless steps |
| Final answers drift from the contract | No output_schema | Add a Pydantic schema plus output_key |
| Reserved-name or syntax errors at import | name not a valid Python identifier | Rename; ADK rejects the reserved name user |
Takeaway: Treat ADK identity as a contract in layers — name/description/model define who the agent is and where it sits in a hierarchy, instruction carries persona plus soft constraints, and output_schema, include_contents='none', and generate_content_config enforce the hard limits the model cannot argue with; use GlobalInstructionPlugin for cross-agent rules instead of the deprecated global_instruction.