code-act
AgentFreeOfficial Repo for ICML 2024 paper "Executable Code Actions Elicit Better LLM Agents" by Xingyao Wang, Yangyi Chen, Lifan Yuan, Yizhe Zhang, Yunzhu Li, Hao Peng, Heng Ji.
Capabilities13 decomposed
unified-code-action-space-for-llm-agents
Medium confidenceConsolidates all LLM agent actions into a single executable Python code representation rather than separate text/JSON/tool-calling modalities. The system uses a Python interpreter integrated with the LLM to generate, execute, and iteratively refine code actions based on execution results in multi-turn conversations. This unified approach eliminates action-space fragmentation and enables the LLM to reason about code semantics directly.
Uses executable Python code as the ONLY action representation (vs. ReAct's text-based reasoning + tool calls, or function-calling APIs that separate action generation from execution). The LLM generates code directly, executes it in isolated environments, and receives execution feedback to refine subsequent code — creating a tight feedback loop between generation and validation.
Achieves 20% higher success rates on M³ToolEval benchmarks compared to text-based or JSON-based agent action spaces because code execution provides deterministic, verifiable feedback that grounds the LLM's reasoning in actual system behavior rather than simulated tool responses.
isolated-code-execution-engine-with-environment-separation
Medium confidenceProvides sandboxed Python execution environments using Docker containers or Kubernetes pods, where each conversation session gets its own isolated runtime. The engine manages container lifecycle, handles code injection, captures stdout/stderr, and enforces resource limits to prevent runaway processes. This architecture ensures security, reproducibility, and clean state separation between concurrent agent conversations.
Implements per-conversation container isolation (not shared interpreters) with Jupyter kernel management for stateful execution across multi-turn interactions. Unlike simple exec() or subprocess approaches, this maintains execution state between code blocks while preserving security boundaries through containerization.
Safer than local subprocess execution (prevents host compromise) and more efficient than spawning new VMs; provides stronger isolation than shared Python interpreters while maintaining state across multi-turn conversations through Jupyter kernel persistence.
execution-result-capture-and-feedback-integration
Medium confidenceCaptures stdout, stderr, return values, and exceptions from code execution and formats them as structured feedback that is fed back to the LLM for reasoning. The system distinguishes between successful execution (with output), runtime errors (with stack traces), and syntax errors (with line numbers). This feedback enables the LLM to understand why code failed and generate corrected versions.
Provides deterministic, unambiguous execution feedback (actual output and errors) rather than simulated tool responses, enabling the LLM to reason about real system behavior. Formats feedback for LLM consumption (truncation, sanitization, structure) rather than raw output.
More informative than binary success/failure signals; more reliable than natural language descriptions of tool outcomes; enables error-driven learning that text-based agents cannot achieve.
benchmark-evaluation-against-agent-task-datasets
Medium confidenceProvides integration with agent evaluation benchmarks (e.g., M³ToolEval) to measure CodeAct performance on standardized task datasets. The system includes evaluation harnesses that run agents on benchmark tasks, collect results, and compute success metrics. This enables quantitative comparison of CodeAct against alternative agent architectures (text-based, JSON-based, tool-calling).
Provides standardized evaluation against M³ToolEval and other benchmarks, demonstrating 20% higher success rates compared to text-based and JSON-based agent action spaces. Enables quantitative comparison rather than anecdotal claims.
Offers empirical evidence of CodeAct's effectiveness vs. alternatives; enables reproducible comparisons; provides detailed failure analysis to guide improvements.
conversation-history-management-and-context-windowing
Medium confidenceManages conversation state across multi-turn interactions, including message history, code blocks, execution results, and LLM responses. The system implements context windowing strategies to fit conversation history within the LLM's context window, using techniques like summarization, truncation, or selective history retention. This enables long conversations while respecting model constraints.
Implements context windowing specifically for CodeAct's code-centric conversations, preserving code blocks and execution results while potentially summarizing natural language explanations. Maintains full history in persistent storage while managing LLM context window separately.
Better suited for code-heavy conversations than generic conversation managers; enables long sessions without losing critical execution context; provides full audit trail for debugging.
multi-turn-code-generation-and-refinement-loop
Medium confidenceImplements a feedback loop where the LLM generates code, the system executes it, captures results (success/failure/output), and feeds execution feedback back to the LLM for iterative refinement. The system maintains conversation history and execution context across turns, allowing the LLM to reason about why code failed and generate corrected versions. This pattern enables self-correction without human intervention.
Closes the feedback loop by returning actual execution results (not simulated tool responses) to the LLM, enabling it to reason about real failure modes. Unlike ReAct or standard tool-calling agents that rely on tool descriptions, CodeAct provides deterministic execution feedback that grounds the LLM's next action in observable system behavior.
More effective at error recovery than single-turn code generation because the LLM sees actual error messages and can adapt; outperforms text-based agents because code execution provides unambiguous success/failure signals rather than natural language descriptions of tool outcomes.
fine-tuned-llm-model-variants-for-code-action-generation
Medium confidenceProvides pre-trained and fine-tuned LLM variants (CodeActAgent-Mistral-7b-v0.1 with 32k context, CodeActAgent-Llama-7b with 4k context) optimized for generating executable Python code as agent actions. These models are instruction-tuned to produce syntactically correct, executable code that integrates with the CodeAct execution engine. The fine-tuning process aligns the model's output distribution toward valid Python code and away from natural language explanations.
Fine-tuned specifically for CodeAct's unified code-action paradigm rather than general code completion. The training process optimizes for generating executable, self-contained Python code that integrates with the execution engine, rather than code snippets or explanatory text.
Smaller and faster than GPT-4 or Claude while maintaining CodeAct-specific optimization; enables on-premises deployment without API dependencies; achieves comparable performance to larger models on CodeAct benchmarks due to task-specific fine-tuning.
web-based-chat-ui-with-conversation-persistence
Medium confidenceProvides a full-featured web interface for interacting with CodeAct agents, with conversation history stored in MongoDB and rendered in a chat-like format. The UI handles message rendering, code syntax highlighting, execution result display, and conversation management. It communicates with the LLM service and code execution engine via backend APIs, abstracting the complexity of agent orchestration from end users.
Integrates code execution results directly into the conversation flow with syntax highlighting and error formatting, rather than treating code and results as separate artifacts. MongoDB persistence enables session resumption and full conversation audit trails.
More polished than CLI-based interfaces for non-technical users; provides persistent conversation history unlike stateless chat interfaces; better suited for production deployments than Jupyter notebooks due to multi-user support and audit logging.
python-script-interface-for-programmatic-agent-access
Medium confidenceProvides a lightweight Python API for programmatically invoking CodeAct agents without a web UI, enabling integration into automated workflows, batch processing, or custom applications. The interface abstracts the LLM service and code execution engine behind a simple function-call API, handling orchestration, state management, and result collection internally.
Provides a minimal, Pythonic API surface that abstracts away the complexity of LLM orchestration and code execution, enabling developers to treat CodeAct agents as callable functions rather than managing state and communication manually.
Simpler to integrate into existing Python codebases than REST APIs; more flexible than web UI for custom workflows; lower overhead than full framework solutions like LangChain for CodeAct-specific use cases.
docker-containerized-deployment-with-llm-serving
Medium confidencePackages CodeAct components (LLM service, code execution engine, optional web UI) into Docker containers with vLLM or llama.cpp for efficient LLM inference. The deployment includes container orchestration, volume mounting for model weights, and networking configuration to enable communication between components. This approach simplifies deployment on single machines or small clusters.
Integrates vLLM or llama.cpp for efficient LLM serving within the container, avoiding the need for separate LLM infrastructure. Provides pre-configured Docker Compose files that bundle LLM service, code execution engine, and optional web UI into a single deployable unit.
Easier to deploy than Kubernetes for small-scale use cases; more reproducible than manual installation; faster inference than CPU-only setups through GPU support in containers.
kubernetes-orchestrated-deployment-with-auto-scaling
Medium confidenceDeploys CodeAct components as Kubernetes pods with horizontal pod autoscaling, persistent volume claims for model weights and conversation data, and service discovery for inter-component communication. The deployment includes ConfigMaps for configuration management, Secrets for API keys, and resource limits to prevent resource exhaustion. This architecture enables production-grade multi-tenant deployments with automatic scaling based on load.
Provides Kubernetes-native deployment with horizontal pod autoscaling for both LLM service and code execution engine, enabling independent scaling of inference and execution capacity. Includes persistent volume management for model weights and conversation data.
Scales better than Docker Compose for high-load scenarios; provides automatic failover and load balancing out-of-the-box; integrates with existing Kubernetes infrastructure in enterprises.
slurm-hpc-cluster-deployment-for-research-workloads
Medium confidenceEnables deployment of CodeAct on high-performance computing clusters using SLURM job scheduling, allowing researchers to run large-scale agent experiments across multiple compute nodes. The deployment integrates with SLURM's job submission, resource allocation, and monitoring systems, enabling batch processing of agent tasks with fine-grained control over compute resources (CPU, GPU, memory, time limits).
Integrates with SLURM's job scheduling and resource management, enabling researchers to submit CodeAct agent experiments as batch jobs with fine-grained resource allocation. Allows leveraging existing HPC infrastructure without requiring Kubernetes or cloud deployments.
Better suited for research workloads than Kubernetes (no container overhead); integrates with existing HPC infrastructure; enables cost-effective large-scale experiments on shared clusters.
jupyter-kernel-based-stateful-code-execution
Medium confidenceUses Jupyter kernels to maintain execution state across multiple code blocks within a single conversation, enabling variables, imports, and function definitions to persist between turns. The system manages kernel lifecycle (creation, execution, cleanup) and handles kernel communication via the Jupyter protocol. This enables stateful multi-turn code execution where later code can reference earlier definitions.
Maintains Jupyter kernel instances per conversation session, enabling stateful code execution where variables and imports persist across turns. Unlike subprocess-based execution that starts fresh each time, this preserves execution context for multi-turn interactions.
More efficient than re-executing all previous code on each turn; enables interactive development patterns; better suited for data analysis workflows than stateless execution engines.
Capabilities are decomposed by AI analysis. Each maps to specific user intents and improves with match feedback.
Related Artifactssharing capabilities
Artifacts that share capabilities with code-act, ranked by overlap. Discovered automatically through the match graph.
CodeAct Agent
Agent that uses executable code as actions.
gpt-engineer
CLI platform to experiment with codegen. Precursor to: https://lovable.dev
OpenDevin
OpenDevin: Code Less, Make More
AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation Framework
[Discord](https://discord.gg/pAbnFJrkgZ)
Together AI
Train, fine-tune-and run inference on AI models blazing fast, at low cost, and at production scale.
smolagents
🤗 smolagents: a barebones library for agents. Agents write python code to call tools or orchestrate other agents.
Best For
- ✓researchers building LLM agent systems and benchmarking against traditional approaches
- ✓teams building autonomous code-generation or data-processing agents
- ✓developers prototyping agents that need to execute and learn from code execution failures
- ✓production deployments where code execution security is critical
- ✓multi-tenant systems serving multiple concurrent agent conversations
- ✓research environments benchmarking agent performance across diverse code execution scenarios
- ✓agents performing exploratory or iterative tasks where error feedback is critical
- ✓systems where code correctness is essential and self-correction is required
Known Limitations
- ⚠Requires Python runtime environment — cannot execute non-Python code natively without additional sandboxing layers
- ⚠Performance depends on LLM's ability to generate syntactically correct Python — malformed code requires error-correction loops
- ⚠Limited to tasks expressible as Python code — not suitable for agents requiring real-time interaction or non-deterministic external APIs
- ⚠Docker/Kubernetes overhead adds 200-500ms per code execution due to container startup and teardown
- ⚠Network I/O from containers to external services may be restricted depending on security policies
- ⚠Stateful code execution (e.g., persistent file handles) requires explicit container persistence configuration
Requirements
Input / Output
UnfragileRank
UnfragileRank is computed from adoption signals, documentation quality, ecosystem connectivity, match graph feedback, and freshness. No artifact can pay for a higher rank.
Repository Details
Last commit: May 23, 2024
About
Official Repo for ICML 2024 paper "Executable Code Actions Elicit Better LLM Agents" by Xingyao Wang, Yangyi Chen, Lifan Yuan, Yizhe Zhang, Yunzhu Li, Hao Peng, Heng Ji.
Categories
Alternatives to code-act
Are you the builder of code-act?
Claim this artifact to get a verified badge, access match analytics, see which intents users search for, and manage your listing.
Get the weekly brief
New tools, rising stars, and what's actually worth your time. No spam.
Data Sources
Looking for something else?
Search →