feat: v0.1.1 — adapters, preconditions, GitHub Action#1
Merged
Conversation
Reuses the same CEL-like expression evaluator as postconditions. PreconditionError raised on failure blocks execution before tokens are spent. Wired into ContractEnforcer.check_preconditions() and the @enforce_contract decorator. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
RunHooks implementation for effect gating (on_tool_start), token tracking (on_llm_end), and postcondition evaluation (on_agent_end). Pinned to openai-agents==0.8.4. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PreToolUse hook returns structured deny for unauthorized tools (not exception — matches Claude SDK convention). PostToolUse observes completion. track_result() extracts cost/tokens from ResultMessage. Pinned to claude-agent-sdk==0.1.50 (Python 3.10+). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 new tests covering precondition evaluation, enforcer integration, OpenAI RunHooks lifecycle (tool blocking, token tracking, postconditions), and Claude hooks (structured deny, budget tracking, result tracking). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add action.yml composite action for CI contract validation. Add PyPI/CI badges to README. Add OpenAI/Claude adapter examples. Pin openai-agents==0.8.4 and claude-agent-sdk==0.1.50 as optional deps. Bump version to 0.1.1. Update CHANGELOG. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ate action - on_agent_end: catch ContractViolation instead of broad Exception - Tests: replace deprecated get_event_loop().run_until_complete with asyncio.run - action.yml: capture validate output once instead of running command twice Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
inputs.preconditions[]evaluated on input BEFORE agent runs. Reuses CEL-like expression evaluator.PreconditionErrorblocks execution before tokens are spent. Wired intoContractEnforcer.check_preconditions()and@enforce_contractdecorator.ContractRunHooks(RunHooks)for effect gating viaon_tool_start, token tracking viaon_llm_end, postcondition evaluation viaon_agent_end. Pinned toopenai-agents==0.8.4.ContractHookswith structured deny via PreToolUse (not exception). Cost/token extraction from ResultMessage. Pinned toclaude-agent-sdk==0.1.50(Python 3.10+).pyyush/agentcontracts@v0.1.1composite action for CI contract validation.Stats
15 files changed, 795 insertions, 3 deletions.
Test plan
pytest)🤖 Generated with Claude Code