AgentBehavior#
Module: agent_framework.agents.agent_behavior
- class agent_framework.agents.agent_behavior.AgentBehavior[source]#
Bases:
objectBehavior extension attached to an agent at load time.
- before_run(agent, host, *, run, caller_id)[source]#
Run before the main loop after initial parameter state has been refreshed.
Behaviors may inspect run.parameter_values, run.missing_parameters, and run.invalid_parameters here. If a behavior mutates prompt state or seed inputs during bootstrap, it may call agent.refresh_parameter_state(run) again to re-resolve the invocation contract before returning.
- Parameters:
agent (Agent)
host (AgentHostProtocol)
run (AgentRun)
caller_id (str | None)
- Return type:
AgentHookDecision | None
- respond_to_callback(agent, host, *, callee_id, prompt)[source]#
- Parameters:
agent (Agent)
host (AgentHostProtocol)
callee_id (str)
prompt (str)
- Return type:
str | None
- after_run(agent, host, *, run, caller_id, result)[source]#
Run after an agent produces a result.
Behaviors may:
return None to leave the result unchanged
return AgentResult to replace the result
return AgentEndHookDecision(continue_run=True, …) to request one more loop iteration with additional prompt fragments
Fragment handling policy:
prompt_fragments replaces existing fragments with the same leading XML-like tag name and is the default update path
append_prompt_fragments appends verbatim without replacement
- Parameters:
agent (Agent)
host (AgentHostProtocol)
run (AgentRun)
caller_id (str | None)
result (AgentResult)
- Return type:
AgentEndHookDecision | ‘AgentResult’ | None