executor
diapason.agents.executor
¶
AgentExecutor — runs a single agent tick.
AgentExecutor
¶
Executes a single tick for a managed agent.
Constructor receives a DiapasonSystem reference for access to engine, tools, config, memory backends, and all other primitives.
execute_tick(agent_id, *, lock_already_held=False)
¶
Run one tick for the given agent.
- Acquire concurrency guard (start_tick)
- Invoke agent with retry logic
- Update stats
- Release guard (end_tick)
lock_already_held is set by callers that took the start_tick()
lock themselves before spawning the worker (e.g. the HTTP /run route
guards against concurrent POSTs by acquiring before threading).
Without this flag, the executor would re-acquire and trip its own
guard — bailing out with no end_tick(), leaving the agent stuck in
status='running' forever.
run_ephemeral(agent_type, system_prompt, input_text, tools=None)
¶
Run a one-shot agent turn with no lifecycle tracking.
set_system(system)
¶
Deferred system injection — called after DiapasonSystem is constructed.