AgentBehavior#

Module: agent_framework.agents.agent_behavior

class agent_framework.agents.agent_behavior.AgentBehavior[source]#

Bases: object

Behavior extension attached to an agent at load time.

attach(agent)[source]#
Parameters:

agent (Agent)

Return type:

None

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:
Return type:

AgentHookDecision | None

respond_to_callback(agent, host, *, callee_id, prompt)[source]#
Parameters:
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:
Return type:

AgentEndHookDecision | ‘AgentResult’ | None