codeact
/codeact
Plan-execute-reflect loop over a persistent Python kernel (the `code-interpreter` MCP): write Python, execute, observe the returned trace (stdout / exception / last value), then revise. Variables, imports, and dataframes survive across every tool call in the session. Use for multi-step numerical reasoning, data wrangling, scientific Q&A, hypothesis-test loops, or any task where intermediate state must persist between turns and a runtime result should drive the next step.
- Author
- dreamlab-ai ↗
- Repository
- agentbox ↗
- Licence
- AGPL-3.0
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 4
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
AGPL-3.0, copyleft: przeróbki udostępniane innym muszą mieć tę samą licencję.
What it does and when to use it
Plan-execute-reflect loop over a persistent Python kernel (the `code-interpreter` MCP): write Python, execute, observe the returned trace (stdout / exception / last value), then revise. Variables, imports, and dataframes survive across every tool call in the session. Use for multi-step numerical reasoning, data wrangling, scientific Q&A, hypothesis-test loops, or any task where intermediate state must persist between turns and a runtime result should drive the next step.
Original author description
Plan-execute-reflect loop over a persistent Python kernel (the `code-interpreter` MCP): write Python, execute, observe the returned trace (stdout / exception / last value), then revise. Variables, imports, and dataframes survive across every tool call in the session. Use for multi-step numerical reasoning, data wrangling, scientific Q&A, hypothesis-test loops, or any task where intermediate state must persist between turns and a runtime result should drive the next step.
How it works
- Quick path — the CodeAct Loop
- When to use
- When NOT to use
- References (on demand)
SKILL.md preview
--- name: codeact description: > Plan-execute-reflect loop over a persistent Python kernel (the `code-interpreter` MCP): write Python, execute, observe the returned trace (stdout / exception / last value), then revise. Variables, imports, and dataframes survive across every tool call in the session. Use for multi-step numerical reasoning, data wrangling, scientific Q&A, hypothesis-test loops, or any task where intermediate state must persist between turns and a runtime result should drive the next step. version: 0.1.0 triggers: - /codeact - write code and run - persistent python - multi-turn computation - data wrangling with state depends_on_mcps: - code-interpreter related_skills: - "sparc:code" # SPARC: orchestrator-shaped, plans then writes; CodeAct executes interactively - deepseek-reasoning # math-heavy reasoning without execution - pytorch-ml # heavy GPU scripts (no shared state) - build-with-quality # full TDD swarm -- when assertions + tests matter more than exploration --- # CodeAct Skill Interactive, stateful Python execution loop using the `code-interpreter` MCP. All agent actions are expressed as executable Python. The kernel persists for the duration of the session; every variable, import, and computed value is available in subsequent tool calls. This skill carries no Python itself — it is a routing and in-context-learning primer. When invoked, it primes the model with the CodeAct Loop protocol and hands off all execution to the `code-interpreter` MCP via `kernel.exec`. --- ## Quick path — the CodeAct Loop 1. **Write** a small, focused Python block addressing the current sub-goal. 2. **Call** `kernel.exec` with that block. 3. **Read** the returned `ExecutionTrace`: inspect `stdout`, `result`, and `exception`. The `ExecutionTrace` is the canonical evidence record; LLM opinion about what the code does is not. 4. If `exception` is non-null or `stdout` does not match the expected output, **revise** and call `kernel.exec` again. If correct, advance to the next sub-goal. 5. All variables from prior `exec` calls remain in the `KernelSession` namespace. Reference them freely without re-importing or recomputing. Continue until the task is complete or a `kernel.reset` is required to clear corrupted namespace state. **Trace-as-Reward (DDD-005)**: the `ExecutionTrace` is ground truth. A clean exit with the expected `stdout`/`result` verifies the step — no LLM judge is in the critical path. The `code-interpreter` MCP exposes six tools on the `KernelSession`: `kernel.exec` (the loop workhorse), plus `kernel.list_vars`, `kernel.inspect`, `kernel.reset`, `kernel.interrupt`, and `kernel.install_pkg` for debugging and introspection. See `references/operations.md` for their session semantics. Worked tool-call syntax (three exemplars showing state persistence across calls): see `references/exemplars.md`. --- ## When to use - Multiple sequential computation steps that depend on each other's results (e.g. load data, filter, aggregate, visualise). - Intermediate state (DataFrames, model objects, parsed structures) would be expensive or awkward to re-derive from scratch on every tool call. - The agent needs to observe a runtime result — an exception traceback, a printed value, an assertion outcome — and revise based on that observation. - Numerical reasoning, data wrangling, hypothesis testing, or scientific computation where the Python interpreter is the source of truth. ## When NOT to use | Instead of CodeAct, use… | When | |---|---| | **Bash** | One-shot execution, no state needed — no kernel overhead. | | **`sparc:code`** | Single-file code generation without execution; plan-then-write, stateless. | | **`deepseek-reasoning`** | Pure symbolic / mathematical reasoning with no data to load. | | **`pytorch-ml`** | Heavy GPU training or multi-file ML scripts — subprocess/script mode; the kernel MCP is CPU-only in v1. | | **`build-with-quality`** | Full TDD pipeline with assertion gates, coverage, defect prediction — a QE swarm, not exploration. | | **`jupyter-notebooks`** | The task is building or running a `.ipynb` notebook file (cell/kernel management, HTML/PDF export) rather than an ephemeral in-session kernel loop — CodeAct's `KernelSession` has no notebook file behind it. | Reach back for **codeact** whenever the task is multi-step *with* state across turns, or data analysis over a single dataset where state should persist so you revise without reloading. --- ## References (on demand) - `references/exemplars.md` — three in-context-learning exemplars with exact `kernel.exec` tool-call syntax and trace outputs, demonstrating `KernelSession` state persistence. - `references/operations.md` — degradation / fail-closed contract, the `agentbox.toml` manifest gate, kernel session semantics (reset / interrupt / inspect, cold-start, serialisation across sessions), identity + ecosystem URN tagging, and composition with `expel-lesson-extractor`, `voyager-skill-library`, and `tree-search-coder`. - `references/empirical-priors.md` — benchmark lifts, token-efficiency data, RSS/cost accounting for swarm sizing, and the ADR/DDD/PRD + arxiv citation list.
Files in this package (4)
- SKILL.md 5 KB
- references/empirical-priors.md 2 KB
- references/exemplars.md 5 KB
- references/operations.md 6 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · dreamlab-ai/agentbox | 90 | AGPL-3.0 |
| gradion-ai/ipybox | 90 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version a666641bcde2 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100dspy-reasoning-modules
Use for DSPy reasoning modules including RLM, ProgramOfThought, CodeAct, Parallel, sandboxed execution, and long-context workflows. - 100claude-code-invoke-persist
Create and resume Claude Code CLI sessions with a persistent session-name-to-session_id mapping (plus last-used model and reasoning effort) stored in a workspace-scoped JSON file under system temp. Use when the user wants deterministic, session-persistent Claude Code automation…