Skip to content

fix: increase default max iterations for agents to improve performanc…#144

Merged
pikann merged 1 commit into
masterfrom
fix/increase-default-max-iterations-for-agents
Jun 5, 2026
Merged

fix: increase default max iterations for agents to improve performanc…#144
pikann merged 1 commit into
masterfrom
fix/increase-default-max-iterations-for-agents

Conversation

@pikann
Copy link
Copy Markdown
Contributor

@pikann pikann commented Jun 5, 2026

Summary

  • Increase default and maximum iteration limits for agents — default max_iterations raised from 50 → 500, and the upper cap from 200 → 500, both in the Go service and the DB migration.
  • Fix 400 errors from sandbox on conversation lookup — removed conversation_id from the Conversation constructor. The sandbox server assigns its own internal UUID; passing our application ID caused GET /api/conversations/{id} to return 400 on all subsequent calls. Event callbacks already persist to our DB using trigger.conversation_id directly, so the mapping stays correct.
  • Fix lingering WebSocket thread after sandbox shutdown — added conversation.close() in the executor finally block. Without this, the SDK's WebSocket client thread outlived the sandbox container; when Docker recycled the container IP, the thread would send requests for the old conversation ID to the new container and receive 400s.

Changes

File Change
services/api/internal/service/agent/agent_service.go maxIterationsLimit 200 → 500; default 50 → 500 (both CreateAgent and UpdateAgent)
services/api/migrations/000008_add_ai_agents.sql max_iterations column default 50 → 500
services/ai-agent/src/agent/executor.py Remove conversation_id arg; add conversation.close() in finally; remove unused import uuid

Test plan

  • Create a new agent and confirm max_iterations defaults to 500
  • Trigger an agent run and verify no 400 errors appear in logs for conversation lookup
  • Stop a sandbox mid-run and confirm no lingering WebSocket thread errors in subsequent runs

🤖 Generated with Claude Code

@pikann pikann merged commit 8ef9eb8 into master Jun 5, 2026
7 checks passed
@pikann pikann deleted the fix/increase-default-max-iterations-for-agents branch June 5, 2026 17:13
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