Skip to content

feat: redesign agent harness with modular architecture + Responses API#90

Merged
cristipufu merged 1 commit intomainfrom
feat/agent-harness-redesign
Feb 27, 2026
Merged

feat: redesign agent harness with modular architecture + Responses API#90
cristipufu merged 1 commit intomainfrom
feat/agent-harness-redesign

Conversation

@cristipufu
Copy link
Member

Summary

  • Modular agent architecture: Replaces monolithic agent_service.py (873 lines) with agent/ package — events, session, provider, tools, context, loop, service modules
  • OpenAI Responses API: Reasoning models (gpt-5.x, o-series) use the Responses API with URL rewrite transport, enabling reasoning summary display in the UI
  • Streaming responses: Text tokens stream to the UI in real-time via TextDelta events
  • Parallel tool execution: Multiple tool calls execute concurrently with asyncio.gather
  • Context management: Automatic compaction at 75% context window + stale tool result pruning
  • Retry with backoff: Transient API errors (rate limits, 5xx) retry up to 3 times
  • Sub-agent dispatch: dispatch_agent tool spawns isolated child loops for research tasks
  • Token tracking: Per-turn and cumulative usage emitted to frontend
  • Thinking UI: Collapsible "Reasoning" card in the chat for model thinking content
  • Reasoning model support: Skips temperature param for gpt-5.x/o-series, prefix-based context window lookup

Test plan

  • Start dev server → open agent chat
  • Send message with gpt-5.x model → verify streaming tokens appear in real-time
  • Verify "Thinking..." indicator hidden while streaming, shown during tool execution
  • Verify tool approval flow works (approve/deny)
  • Verify plan bullets update to "completed" before final response
  • Test with non-reasoning model (gpt-4o) → verify Chat Completions path still works
  • Test stop button cancels running session
  • npm run build in frontend directory succeeds
  • uv run ruff check src/ tests/ + uv run mypy src/ pass clean

🤖 Generated with Claude Code

Replaces the monolithic agent_service.py (873 lines) with a modular
package (agent/) featuring: typed event system, streaming responses,
parallel tool execution, context compaction, retry with backoff,
sub-agent dispatch, token tracking, and OpenAI Responses API support
for reasoning models (gpt-5.x) with thinking/reasoning UI.

- New: agent/{events,session,provider,tools,context,loop,service}.py
- Provider: Chat Completions for standard models, Responses API for
  reasoning models (gpt-5.x, o-series) with URL rewrite transport
- Frontend: ThinkingCard component, streaming text deltas, token usage
- Bump version to 0.0.64

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cristipufu cristipufu force-pushed the feat/agent-harness-redesign branch from 612dd8a to cb96415 Compare February 27, 2026 14:28
@cristipufu cristipufu merged commit 5f6c432 into main Feb 27, 2026
11 checks passed
@cristipufu cristipufu deleted the feat/agent-harness-redesign branch February 27, 2026 14:31
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