Skip to content

feat: reuse agent instance per conversation ID in antigravity harness server#83

Open
anj-s wants to merge 1 commit into
mainfrom
u/anj/issue-65-agent-per-conv
Open

feat: reuse agent instance per conversation ID in antigravity harness server#83
anj-s wants to merge 1 commit into
mainfrom
u/anj/issue-65-agent-per-conv

Conversation

@anj-s

@anj-s anj-s commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Reuses Agent instances per conversation_id in the Python antigravity harness server to avoid recreating them on each Connect call.
  • Clears conversation._steps before extending it with history on each turn to prevent history duplication.
  • Introduces a cleanup() method to gracefully exit all active agent sessions upon server shutdown.
  • Added a TODO for future eviction/idle-timeout policy implementation.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Breaking change

Related Issues

Closes #65

Test Plan

  • Unit tests pass: pytest python/antigravity/harness_server_test.py passes.
  • Integration tests pass: go test ./internal/harness/... passes.
  • Verified locally: Confirmed only 2 agents are instantiated when 3 turns are fired (2 for conv-1, 1 for conv-2).

Notes for Reviewer

  • Resolves the issue where agent sessions were stateless and recreated per gRPC Connect call.
  • Uses asyncio.Lock to ensure thread-safety when accessing/initializing the agent map.

… server

Closes #65. Prevents recreating Agent instances on each Connect call. Replaces history list in place and cleans up agents on shutdown.
@anj-s anj-s requested a review from wjjclaud June 13, 2026 05:29
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.

Update the example antigravity harness server to have one agent instance per conversation ID.

1 participant