agora.fleet.auto_hooks
Automatic validation + git + completion hooks fired after tool calls.
Weak LLMs (qwen2.5:7b and similar) cannot reliably juggle a multi-step protocol
of write_file → check_python → run_python_import → git_commit →
mark_complete. They burn iterations on orchestration and bail before calling
mark_complete. This module runs those validation + bookkeeping tools
automatically on the framework side, so the agent only has to decide what to
write.
The hooks are passive from the LLM’s perspective: the results of auto-run tools
are appended to the message history as synthetic tool_result entries, so the
model sees check_python errors on its next turn and can fix the file — but
it never has to remember to call the tool itself.
Functions
|
Return the list of auto-invocations triggered by a finished tool call. |
|
Append a synthetic |
Classes
One automatically-run tool's output. |
- class agora.fleet.auto_hooks.AutoHookResult[source]
Bases:
objectOne automatically-run tool’s output.
- __init__(tool_name, arguments, result, success)
- async agora.fleet.auto_hooks.run_auto_hooks(call_name, call_arguments, call_result, ctx)[source]
Return the list of auto-invocations triggered by a finished tool call.
Currently only
write_filetriggers hooks. The chain is:on
.pyfiles:check_python→ (if clean)run_python_importon
requirements.txt:check_requirementsafter any successful write with a git repo:
git_commit
A hook chain stops on the first failure so the agent sees one focused error at a time.
- agora.fleet.auto_hooks.synthesize_mark_complete(ctx, final_text)[source]
Append a synthetic
mark_completeentry if the LLM never called one.Returns True when a synthetic entry was appended, False when the LLM’s own
mark_completewas present (nothing to do).The summary is derived from
final_text(last LLM content) and the artifact list is taken fromctx.written_files. This keeps the_postcond_mark_completecontract satisfied even when the model bails attool_calls=0without the courtesy of calling the tool itself — which is the dominant failure mode on weak models.