Agent definition fields

July 19, 2026 · View on GitHub

Agent is the declarative configuration you build with Agent.builder(). Each field below lists its builder method, the JSON key it serializes to, and any behavior notes.

Fields

FieldBuilder methodJSON keyNotes
namename(String)nameRequired. Pattern ^[a-zA-Z_][a-zA-Z0-9_-]*$.
modelmodel(String)model"provider/model" format. Omitted for external agents.
instructionsinstructions(String)instructionsSystem prompt. Overridden by instructionsTemplate if set.
instructionsTemplateinstructionsTemplate(PromptTemplate)instructions (structured)Emitted as a PromptTemplateRef map. Takes precedence over plain instructions.
introductionintroduction(String)introductionPrepended before the first user message in multi-agent discussions.
toolstools(ToolDef...)toolsList of tool configs.
agentsagents(Agent...)agentsSub-agents (recursive). Requires a strategy.
strategystrategy(Strategy)strategyEmitted only when sub-agents or planner/fallback slots are present. Default HANDOFF.
routerrouter(Agent)routerFor ROUTER strategy. Nested agent config.
guardrailsguardrails(GuardrailDef...)guardrailsInput/output guardrail configs.
maxTurnsmaxTurns(int)maxTurnsDefault 25. Emitted only if > 0.
maxTokensmaxTokens(int)maxTokensLLM token cap.
temperaturetemperature(double)temperatureSampling temperature.
timeoutSecondstimeoutSeconds(int)timeoutSecondsAlways emitted (including 0). 0 → server applies its default.
terminationtermination(TerminationCondition)terminatione.g. MaxMessageTermination, StopMessageTermination.
outputTypeoutputType(Class<?>)outputTypeStructured-output class name.
handoffshandoffs(Handoff...)handoffsSWARM triggers: OnTextMention, OnToolResult, OnCondition.
allowedTransitionsallowedTransitions(Map)allowedTransitionsSWARM: restricts which agents may transfer to which.
credentialscredentials(String...)credentialsSecret names resolved by a capable server and delivered to tool context at runtime.
requiredToolsrequiredTools(String...)requiredToolsTool names that must be called during the run.
metadatametadata(Map)metadataArbitrary key-values stored with the workflow definition.
synthesizesynthesize(boolean)synthesizeEmitted only when false (default true).
statefulstateful(boolean)statefulEmitted as true when set. Triggers per-execution domain isolation (runId).
sessionIdsessionId(String)sessionIdEmitted inside agentConfig and as a top-level AgentRequest field.
baseUrlbaseUrl(String)baseUrlPer-agent LLM provider endpoint override.
includeContentsincludeContents(String)includeContents"none" = fresh context; absent = inherit parent context.
thinkingBudgetTokensthinkingBudgetTokens(int)thinkingConfigEmitted as {enabled: true, budgetTokens: N}. Anthropic extended thinking.
enablePlanningenablePlanning(boolean)enablePlanningPrepends a "plan first" preamble to the system prompt.
prefillToolsprefillTools(List)prefillToolsTool calls executed before the first LLM turn; results injected as context.
plannerplanner(Agent)plannerPLAN_EXECUTE named slot.
fallbackfallback(Agent)fallbackPLAN_EXECUTE fallback agent.
fallbackMaxTurnsfallbackMaxTurns(int)fallbackMaxTurnsPLAN_EXECUTE only.
plannerContextplannerContext(List<Context>)plannerContextPLAN_EXECUTE only. Text/URL context appended to the planner's prompt. Throws at build() if strategy ≠ PLAN_EXECUTE.
localCodeExecutionlocalCodeExecution(boolean)codeExecutionEmitted as a CodeExecutionConfig. Injects a run_code worker tool.
allowedLanguagesallowedLanguages(List)codeExecution.allowedLanguagesDefault ["python"].
codeExecutionTimeoutcodeExecutionTimeout(int)codeExecution.timeoutDefault 30s.
allowedCommandsallowedCommands(List)codeExecution.allowedCommandsShell commands permitted during code execution.
cliConfigcliConfig(CliConfig)cliConfigInjects a run_command worker tool.
gategate(TextGate)gateSequential pipeline gate: {type: "text_contains", text, caseSensitive}.
stopWhenTaskNamestopWhen(String)stopWhenEmitted as {taskName: name}.
callbackscallbacks(CallbackHandler...)callbacksIntrospected for before_model, after_model, before_agent, after_agent.
beforeModelCallbackbeforeModelCallback(Function)callbacks (position before_model)Emitted as a callback entry.
afterModelCallbackafterModelCallback(Function)callbacks (position after_model)Emitted as a callback entry.
beforeAgentCallbackbeforeAgentCallback(Function)callbacks (position before_agent)Emitted as a callback entry.
afterAgentCallbackafterAgentCallback(Function)callbacks (position after_agent)Emitted as a callback entry.
memorymemory(ConversationMemory)memoryEmitted as {messages, maxMessages}. Multi-turn message history.
reasoningEffortreasoningEffort(String)reasoningEffortOpenAI reasoning models: "low", "medium", "high". Ignored by other models.
maskedFieldsmaskedFields(String...)maskedFieldsField names redacted in execution history/UI.
contextWindowBudgetcontextWindowBudget(int)contextWindowBudgetToken threshold for proactive context condensation.
frameworkframework(String)(dispatch key)Selects the serialization path; not emitted as a field.
frameworkConfigframeworkConfig(Map)(merged at top level)For framework agents; entries merged into the output map.

Serialization behavior

A few fields serialize non-obviously:

  • Strategy is emitted only when sub-agents or PLAN_EXECUTE named slots (planner/fallback) are present, so a plain single agent does not carry a redundant "strategy": "handoff".
  • Framework dispatchframework is a dispatch key, not a field. Native agents serialize as {agentConfig}; framework-backed agents ("skill", "openai", "google_adk") take an early-exit path and serialize as {framework, rawConfig}, with frameworkConfig merged into the top level of the output.
  • synthesize defaults to true and is emitted only when false.
  • Callbacks — the four function-typed callbacks and the callbacks list all serialize into a single callbacks list. Function objects are never sent; each becomes a Conductor task reference at its position, and the runtime registers the function as a local worker.

Defaults

FieldBuilder default
strategyHANDOFF
maxTurns25
timeoutSeconds0 (→ server default)
codeExecutionTimeout30 seconds
synthesizetrue
statefulfalse
enablePlanningfalse
localCodeExecutionfalse