crewAIInc / crewAIInc/crewAI

Production Safety Features for Local Code Execution

Open
#6,246 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

no-issue-activity
Dominant language
Python
Stars
58.8k
Forks
8.5k
Avg merge
1d 15h
Merged PRs (30d)
109

Description

Following up on the discussion about production-safe code execution patterns (#6180).

We've implemented the production safety guardrails that frameworks like CrewAI need:

What We Built

Per-Operation Metrics & Loop Detection

  • Track tool_calls, api_spend_estimate, memory_mb, cpu_percent
  • Automatic loop detection: 3+ identical tool calls trigger alert
  • Enable crews to detect runaway scenarios and trigger graceful cancellation

Stateful Long-Running Operations

  • Stable operation IDs for resumption
  • Typed waiting states (queued, executing, completed, error, cancelled)
  • Idempotent polling for safe retries
  • Graceful cancellation with SIGTERM + timeout

Production Guardrails

  • Daily operation quota tracking
  • Per-operation resource monitoring
  • Timeout enforcement
  • Comprehensive test suite (6/6 cancellation scenarios passing)

Reference Implementation

The cowork-to-code-bridge MCP server implements these patterns and is production-ready:

These patterns address the core safety concerns:

  • ✅ Quota enforcement (prevent runaway costs)
  • ✅ Loop detection (catch infinite retries)
  • ✅ Graceful cancellation (stop hung processes)
  • ✅ Resource monitoring (memory, CPU tracking)

Thought this might be valuable for CrewAI teams building production agents. Happy to discuss patterns or collaboration opportunities!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the discussion in #6180 and review the linked Code Execution Strategy, Stateful Operations, and External Agent Integration guides. Determine whether these external patterns map to a concrete change in CrewAI; the issue is complete only when a specific, agreed implementation scope and acceptance criteria are defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.