Repository navigation
Opt hook example - #91
Merged
Merged
Conversation
Replace the lightweight hook module note with a detailed design document aligned to the agent detailed-doc granularity, including contracts, lifecycle phases, dispatch flow, patch governance, builder/config integration, reliability semantics, and known gaps. Add examples/08-hook-governance as a real OpenRouter-backed interactive CLI (mirroring the 05-style runtime workflow) with a custom GovernancePolicyHook that demonstrates: - BEFORE_MODEL model_input patch visibility - BEFORE_MODEL keyword-based BLOCK behavior - BEFORE_TOOL ALLOW/BLOCK visibility (including write_file policy block) - /stats introspection for phase and policy hit counters Set the default example workspace to Path.cwd() so user prompts about the current directory behave as expected, and document the README path nuance in the example README. Add focused unit tests for the 08 example to verify command parsing, default workspace behavior, BEFORE_MODEL block/patch behavior, and BEFORE_TOOL tracking.
Improve runtime robustness across transport, ReAct loop handling, and OpenRouter serialization. Key changes: - base_agent: emit structured AGENT_EXECUTION_FAILED envelopes when execute() raises. - react_agent: add fallback text for empty final model replies and a repeated-tool-call loop guard. - openrouter_adapter: preserve assistant tool_calls in OpenRouter function-call format. - examples/02-with-tools: simplify channel wiring and await builder build() consistently. - tests: add/extend unit coverage for transport error signaling, loop guard/fallback behavior, example channel construction, and adapter tool_call serialization. Rationale: - Prevent silent failures in transport mode and make client error handling deterministic. - Avoid non-converging tool loops and empty user-facing responses in ReAct execution. - Keep tool-call context intact for multi-turn OpenRouter interactions. - Ensure sample code reflects current runtime contracts and prevent regressions via tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scope (One PR One Thing)
Changed Files (required)
List all touched files and why each file changed.
If this PR is a large diff (>300 changed lines), explain why split PRs are not possible and provide a split follow-up plan.
Acceptance Criteria
Test Evidence (required)
.........If this PR changes high-risk runtime paths (auth/concurrency/execution control), include
risk-matrixevidence.Risk and Rollback
Dependency and Lockfile Changes
requirements.txt/pyproject.toml/package.json): [ ] Yes [ ] No [ ] N/AAgent Rules Checklist (required)
Reference:
docs/agent_rules.mdskip/only/excludeusage is explained and reviewed