Concepts/Definition
ADPS Agent Systems · Engineering Concept
CodeAct: Code as Action
Use executable code as the agent's action language for computation, libraries, and tool composition.
Application context
A data-analysis agent reads tables, cleans fields, computes statistics, produces charts, and revises its logic after an error. Wrapping every operation as a separate JSON tool causes the registry to keep growing and requires repeated model calls to compose simple operations.
Definition
CodeAct uses executable Python as a unified action space. The model can call available functions and libraries, create local variables and helpers, and revise an earlier action after the interpreter returns a result or error. The original research concerns code as an action during a run, not the durable storage of that code.
Boundary with Programmatic Tool Calling
Both mechanisms ask the model to write code. Programmatic Tool Calling centres on registered tools: code batches their calls and reduces intermediate results while each tool remains explicitly admitted. CodeAct is more general. Its code can compute directly, use runtime libraries, and create temporary operations. It therefore tends to expose a broader capability and attack surface.
Engineering use
The runtime isolates files, processes, networks, and credentials and sets time and resource limits. Code, dependencies, input digest, execution output, and errors enter the trace. External writes still pass through A1 Tool Dispatch, A4 Guardrail Sandwich, and governance controls; expressing an action as code does not bypass authority.
Boundary with M5 Procedural Memory
Code generated and executed for one task is CodeAct. It becomes M5 Procedural Memory only after repeated validation, naming, versioning, dependency and trigger declarations, and approval for later runs. Saving a script that happened to work once does not create a reusable capability.
Proposal and provenance
- Concept group
- Reasoning and action mechanisms
- Term origin
- External research term: Wang et al.
- Published source
- Executable Code Actions Elicit Better LLM Agents, ICML 2024
- ADPS editorial work
- ADPS separates one-run code actions from validated, reusable M5 Procedural Memory.
- Current standing
- Runtime-mechanism concept
Chronicle
- Recorded source
- Executable Code Actions Elicit Better LLM Agents, ICML 2024
- First published on ADPS