Skip to content

feat: A2A agent inner loop framework (2/3)#199

Open
mdear wants to merge 2 commits into
Intelligent-Internet:mainfrom
mdear:feature/a2a-agent-inner-loop_2_of_3
Open

feat: A2A agent inner loop framework (2/3)#199
mdear wants to merge 2 commits into
Intelligent-Internet:mainfrom
mdear:feature/a2a-agent-inner-loop_2_of_3

Conversation

@mdear
Copy link
Copy Markdown

@mdear mdear commented Apr 13, 2026

A2A Agent Inner Loop Framework (2/3)

Merge order: This PR targets main but is intended to be merged after feature/local-docker-sandbox_1_of_3 (#198). It includes all B1 changes plus the incremental A2A agent layer below.

74 files changed (incremental from 1/3) — A2A inner loop strategy, backend registry, billing strategies, and comprehensive test coverage.

A2A Inner Loop

  • A2AInnerLoop strategy with SSE streaming client
  • CircuitBreaker (threshold=5) with automatic native fallback
  • EventStreamAdapter mapping SSE events to agent runtime events
  • ContextAdapter for conversation history parity with native loop
  • ToolBridge for bidirectional tool registration between backends
  • Agent factory wiring for inner loop strategy selection

A2A Adapter Server & Backends

  • AdapterServer (FastAPI/uvicorn) running inside sandboxes on :18100
  • Backend registry with simulate, copilot, claude_code, codex providers
  • CopilotBackend using GitHub Copilot SDK (github-copilot-sdk>=0.1.25)
  • 15 native sandbox tools bridged to Copilot CLI
  • ClaudeCodeBackend and CodexBackend implementations
  • Multimodal support across backends
  • Sandbox start-services.sh A2A adapter startup section

A2A Billing

  • Backend-aware billing in CreditUsageHandler (a2a: prefix routing)
  • Three strategies: token_based, provider_reported, none
  • Copilot premium-request multipliers (hot-configurable via env)
  • AgentSettings: A2A billing strategy, multipliers, inner loop mode, timeout, fallback config

Events & Config

  • EventGroup, EventType enums and ApplicationEvent model
  • DelegationFallbackEvent, CompactionAuthorityEvent, CompactionSkippedEvent
  • ModelUsageEvent A2A billing fields (billing_backend, is_user_key, premium_requests, model_multiplier)
  • CompactionLock async context manager for cross-authority compaction guard
  • Health endpoint: A2A inner loop mode and backend fields

Testing

  • 26 new test files covering all A2A components
  • Inner loop, tool bridge, agent factory, circuit breaker, event mapping
  • Backend tests: copilot, claude_code, codex, adapter server, multimodal
  • Credit usage handler A2A billing tests
  • Unit: 5520 passed, 3 skipped, 0 failed
  • E2E: 30 pass, 1 skip, 1 expected fail (chat A2A routing — added in 3/3)

Docs

  • A2A billing model design doc with strategy comparison
  • Copilot SDK integration assessment, inner loop parity assessment
  • Tool bridge gap analysis, implementation handoff guide
  • 17 design/impl/runtime/test docs

mdear added 2 commits April 13, 2026 15:22
- Docker Compose local stack with PostgreSQL, Redis, MinIO, sandbox
- Local sandbox entrypoint, VNC, browser automation services
- Stack control scripts (stack_control.sh, local/*)
- Backend Dockerfile + entrypoint for local development
- Configuration: .stack.env.local, settings.yaml, model_configs
- SQLAlchemy model fixes (UUID consistency, TimestampColumn)
- Agent tool/runtime improvements (reasoning_content, field renames)
- Credit billing_enabled toggle + usage handler refactor
- E2B sandbox management, VNC URL support
- 246 tests (unit, integration, smoke, E2E)
- Documentation: architecture, getting-started, local-docker-sandbox
- GitHub Copilot instructions and prompt templates
- A2A protocol: adapter server, backends (Copilot, Claude Code, Codex)
- Agent inner loop: strategy pattern, tool bridge, routing
- A2A billing: backend-aware credit calculation, provider-reported strategies
- Circuit breaker, event stream adapter, multimodal support
- Agent factory: inner loop strategy builder, converter
- Health endpoint: A2A mode fields
- CreditUsageHandler: A2A billing strategies
- Config: A2A agent settings (inner_loop_mode, a2a_backend, billing)
- 26 A2A agent tests + 10 billing strategy tests
- 17 A2A design/implementation/runtime docs
@mdear
Copy link
Copy Markdown
Author

mdear commented Apr 13, 2026

I am continuing testing on branch feature/a2a-chat-inner-loop_3_of_3 and will not introduce churn on this PR unless requested by the team.

@mdear
Copy link
Copy Markdown
Author

mdear commented Apr 16, 2026

This PR is 2 out of a sequence of 3 PRs:

#198#198: Docker sandbox runtime, local deploy stack, session lifecycle, frontend, test overhaul (389 files)

#199#199: A2A inner loop strategy, backend registry, billing strategies, adapter server (74 incremental files)

#200#200: Chat A2A turn loop, council A2A routing, cross-authority compaction (16 incremental files)

Merge order: #198#199#200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant