Skip to main content

CodeAct implementation with Docker and MCP

Project description

CodeArkt

PyPI CI License Stars DeepWiki

CodeArkt is a battery-included implementation of the CodeAct framework with support for the multi-agent architecture. Ship autonomous agents that can reason, write, execute & iterate over code. All from a single Python package.


✨ Why CodeArkt?

  • Multi-agent orchestration – coordinate hierarchies of specialist agents.
  • Secure Python sandbox – secure, ephemeral Docker execution environment for code actions.
  • First-class tool ecosystem – auto-discover & register MCP tools.
  • Drop-dead simple UI – launch an elegant Gradio chat or run the terminal client.
  • Production ready – typed codebase (mypy --strict), CI, tests, Docker & Apache-2.0 license.

🚀 Quick Start

Install the package:

pip install codearkt  # requires Python ≥ 3.12

Run your MCP servers:

python -m academia_mcp --port 5056 # just an example MCP server

Run a server with a simple agent and connect it to your MCP servers:

import os
from codearkt.codeact import CodeActAgent
from codearkt.llm import LLM
from codearkt.server import run_server

# Use your own or remote MCP servers
mcp_config = {
    "mcpServers": {"academia": {"url": "http://0.0.0.0:5056/mcp", "transport": "streamable-http"}}
}

# Create an agent definition
api_key = os.getenv("OPENROUTER_API_KEY", "")
assert api_key, "Please provide OpenRouter API key!"
agent = CodeActAgent(
    name="manager",
    description="A simple agent",
    llm=LLM(model_name="deepseek/deepseek-chat-v3-0324", api_key=api_key),
    tool_names=["arxiv_download", "arxiv_search"],
)

# Run the server with MCP proxy and agentic endpoints
run_server(agent, mcp_config, port=5055)

Now run a Python client:

from codearkt.client import query_agent
from codearkt.llm import ChatMessage

history = [ChatMessage(role="user", content="Find an abstract of the 2402.01030 paper")]

for event in query_agent(history, port=5055):
    if event.content:
        print(event.content, end="", flush=True)

Within seconds, you will see agents collaborating, executing Python snippets, and streaming the results back to your console.

You can also use existing clients, Gradio and terminal:

uv run -m codearkt.terminal --port 5055
uv run -m codearkt.gradio --port 5055

🧩 Feature Overview

Area Highlights
Agents Hierarchical manager / worker pattern, pluggable prompts, configurable iteration limits
Tools Automatic discovery via MCP registry, Python execution (python_interpreter)
Execution Sandboxed temp directory, timeout, streamed chunks, cleanup hooks
Observability AgentEventBus publishes JSON events – integrate with logs, websockets, or GUI. Opentelemetry is also supported.
UI Responsive Gradio Blocks chat with stop button, syntax-highlighted code & output panels
Extensibility Compose multiple CodeActAgent instances, add your own LLM backend, override prompts

📖 Documentation

For now, explore the well-typed source code.


🛠️ Project Structure

codearkt/
├─ codeact.py          # Core agent logic
├─ python_executor.py  # Secure sandbox for arbitrary code
├─ event_bus.py        # Pub/Sub for agent events
├─ gradio.py           # Optional web UI
└─ ...
examples/
└─ multi_agent/        # End-to-end usage demos

🤝 Contributing

Pull requests are welcome! Please:

  1. Fork the repo & create your branch: git checkout -b feature/my-feature
  2. Install dev deps: make install
  3. Run the linter & tests: make validate && make test
  4. Submit a PR and pass the CI.

Join the discussion in Discussions or open an Issue.


📝 License

CodeArkt is released under the Apache License 2.0 – see the LICENSE file for details.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codearkt-1.6.7.tar.gz (40.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codearkt-1.6.7-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file codearkt-1.6.7.tar.gz.

File metadata

  • Download URL: codearkt-1.6.7.tar.gz
  • Upload date:
  • Size: 40.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.24

File hashes

Hashes for codearkt-1.6.7.tar.gz
Algorithm Hash digest
SHA256 a6be7df5766eef37f735f6bbe4f942de3973ad8817656bed689cd5d364ec1e71
MD5 63772423f87eb61a304088288ffe2b21
BLAKE2b-256 8690f57e9d5be5571d886a858c86407fee1426b7c2161d9577c7730e0743dfdd

See more details on using hashes here.

File details

Details for the file codearkt-1.6.7-py3-none-any.whl.

File metadata

  • Download URL: codearkt-1.6.7-py3-none-any.whl
  • Upload date:
  • Size: 35.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.24

File hashes

Hashes for codearkt-1.6.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f470929de27a818888a760eb4fcb8d855ce3c9ca04d8659209bbd9931801323c
MD5 baa74a01feffd90dd3e7fc089fce517f
BLAKE2b-256 489e8d1b7f27258656561c6bba4104650e249563fa432e4cffd72b53c041e75a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page