Skip to content

Conversation

@ahmedtariqh
Copy link

Summary
This PR addresses critical stability issues, enhances the agent's reliability with loop detection, and lays the backend foundation for the new "Playbooks"
feature. It also improves the model selection logic to support custom models and graceful fallbacks.

Key Changes

  1. Reliability & Loop Detection
  • Loop Protection: Implemented a LoopDetector in AgentProcessor (packages/bytebot-agent/src/agent/agent.processor.ts). The agent now tracks the last 5
    actions and will interrupt execution if it detects 3 identical consecutive actions, preventing infinite billing loops or "stuck" states.
  1. Playbooks Backend (New Feature)
  • Schema: Added Playbook model to schema.prisma to support saving reusable task templates.
  • API: Implemented PlaybooksModule, PlaybooksController, and PlaybooksService to provide full CRUD endpoints for managing playbooks.
  • Integration: Registered the new module in app.module.ts.
  1. Model Adapter & Configuration
  • Unified Adapter: Refactored AgentProcessor to support a "Proxy Fallback" mechanism. If a requested model provider is not explicitly implemented, the
    agent now defaults to the generic Proxy service, enabling broader model support.
  • Custom Models: Added packages/bytebot-agent/src/config.ts to parse LLM_CONFIG_JSON, allowing users to inject custom model definitions (e.g., local
    Ollama endpoints or niche providers) without code changes.
  • API Exposure: Updated TasksController to include these custom models in the GET /tasks/models response.
  1. Stabilization
  • UI Proxy: Hardened packages/bytebot-ui/server.ts to include a default fallback for BYTEBOT_AGENT_BASE_URL, preventing the UI container from crashing on
    startup if the environment variable is missing.

Testing Plan

  • Loop Detection: Verified by simulating repetitive tool calls; the agent correctly throws a Self-Correction error after the 3rd repetition.
  • Playbooks: Verified the API endpoints (GET/POST /playbooks) function correctly with the new Prisma schema.
  • Model Fallback: Confirmed that specifying an unknown provider now routes traffic to the Proxy service instead of failing.

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