release: v0.16.3 — agent refactoring + astream() full parity#5
Merged
johnnichev merged 1 commit intomainfrom Mar 15, 2026
Merged
release: v0.16.3 — agent refactoring + astream() full parity#5johnnichev merged 1 commit intomainfrom
johnnichev merged 1 commit intomainfrom
Conversation
Refactor Agent class to eliminate ~800 lines of duplicated setup/teardown logic across run(), arun(), and astream() via shared helpers. Fix 14+ feature gaps in astream() that made it a second-class execution method. Added: - Agent.name property, Agent.__call__() shorthand - parent_run_id param on run/arun/astream for trace linking - response_format param on astream (was missing) - GraphExecutionError exception (v0.17.0 pre-work) - _RunContext dataclass + _prepare_run/_finalize_run/_process_response helpers - _clone_for_isolation() for batch processing - 29 regression tests (tests/agent/test_astream_parity.py) Fixed (astream parity): - Input/output guardrails, knowledge/entity/KG context injection - Session load/save, memory summary, coherence checks - Tool output screening, analytics, verbose output, chunk callback - Structured output validation, reasoning extraction, tool_selection traces - Tool-not-found and policy denial trace steps, per-tool usage tracking - History append order, full AgentResult fields Docs: Updated AGENT.md, EXCEPTIONS.md, ARCHITECTURE.md, index.md, README.md, CLAUDE.md with new features and corrected counts.
johnnichev
added a commit
that referenced
this pull request
Mar 24, 2026
Security: - Path traversal in JsonFileSessionStore — validate session_id (#9) - Unicode homoglyph bypass in injection screening — NFKD + zero-width strip + homoglyph map (#13) Data integrity: - FileKnowledgeStore._save_all() atomic write via tmp + os.replace (#10) - JsonFileSessionStore.save() atomic write (#31) Agent core: - astream() uses self._effective_model (was self.config.model) (#1) - Sync _check_policy rejects async confirm_action with clear error (#2) - Sync _streaming_call isinstance(chunk, str) guard (#18) Providers: - FallbackProvider stream()/astream() record success after consumption, not before — circuit breaker now works for streaming (#3) - Gemini response.text ValueError catch for tool-call-only responses (#4) Tools: - aexecute() uses run_in_executor(None) shared executor (#5) - execute() awaits coroutines from async tools via asyncio.run (#6) RAG: - Hybrid search O(n²) → O(1) via text_to_key dict lookup (#7) - SQLiteVectorStore thread safety + WAL mode (#8) Evals: - OutputEvaluator catches re.error on invalid regex (#11) - JsonValidityEvaluator respects expect_json=False (#12) 16 new regression tests. Full suite: 2000 passed.
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
Agentclass — extracted_RunContext,_prepare_run(),_finalize_run(),_process_response(),_build_max_iterations_result()shared helpers, eliminating ~800 lines of duplicated setup/teardown/iteration logic acrossrun(),arun(), andastream()Agent.name,Agent.__call__(),parent_run_idparam,GraphExecutionError,_clone_for_isolation()Test plan
tests/agent/test_astream_parity.pyblack,isort,flake8,mypyall cleanmkdocs buildsucceeds with no new warnings🤖 Generated with Claude Code