[P0.7] Frozen Agent & Tool interfaces + contract tests - #66
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a “frozen” Python contract surface for Arc agents and tools, plus a reference EchoAgent and a contract-test suite to lock the interface (Issue #7 / P0.7) so agent and orchestrator work can proceed in parallel against stable I/O models and protocols.
Changes:
- Adds
AgentInput/AgentOutputPydantic models andAgent/genericTooltyping.Protocolcontracts (runtime-checkable). - Adds a minimal
EchoAgentreference implementation and a comprehensive contract test suite validating protocol conformance, JSON round-trips, confidence bounds, and schema derivation. - Adds
contractspackage exports, README guidance, and pinned runtime/dev dependencies for running the contracts/tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/agent_interface.py | Defines the frozen Agent I/O models and Agent/Tool protocols; includes draft tool model signatures. |
| contracts/echo_agent.py | Adds a minimal reference agent implementation for validating the Agent protocol end-to-end. |
| contracts/tests/test_agent_interface.py | Adds contract tests covering protocol conformance, JSON round-trips, validation constraints, and schema generation. |
| contracts/tests/init.py | Marks contracts.tests as a test-only package with a module docstring. |
| contracts/init.py | Establishes the package-level public import surface via re-exports. |
| contracts/README.md | Documents what is frozen vs draft and how to implement/run a conforming agent. |
| contracts/requirements.txt | Pins runtime dependency (pydantic) for the contracts surface. |
| contracts/requirements-dev.txt | Pins dev/test dependencies (pytest, pytest-asyncio) for the contracts test suite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| class NotAnAgent: | ||
| name = "nope" | ||
|
|
||
| # Act / Assert -- the protocol requires the async `run` too |
| Run standalone: `python -m contracts.echo_agent` | ||
| """ | ||
|
|
||
| from contracts.agent_interface import Agent, AgentInput, AgentOutput |
|
|
||
| Producer: every agent. Consumer: orchestrator runtime + SSE stream + | ||
| prioritized action report. `confidence` drives the Root-Cause re-query gate | ||
| (Vultr compliance: retrieve more than once when confidence is low). |
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.
Closes #7
Contrat FROZEN
Tests
27 contract tests green (Protocol conformance, JSON round-trip for SSE, confidence bounds incl. NaN, extra=forbid, JSON schemas for all 6 tool models). pip-audit: 0 CVE.
@simerugby: tool signatures are DRAFT until your approval — if anything clashes with your backend plans, comment and we amend BEFORE anyone builds on them. Merged fast per hackathon flow, review post-merge welcome.