pi-mojo is a native Mojo port of Piβa popular, tool-efficient agentic AI platform (utilizing only 4 core tools) prominent in open-source systems like OpenClaw. It provides the Mojo community with a compiled, self-contained reference implementation to explore systems-level agent architectures, type-safe structures, and native C integrations.
Ensure you have the Modular Mojo compiler installed:
mojo --versionThe repository features progressive, systems-level agentic AI examples demonstrating the spectrum of agent architectures and compiled system execution capabilities:
A progressive exploration of text completions, starting from zero dependencies, local llm and live cloud LLMs.
mojo -I src examples/example_1_basic_ai/example_basic_ai.mojoA systems agent that translates high-level task descriptions into shell commands and executes them natively via system process spawning.
mojo -I src examples/example_2_coding_agent/example_coding_agent.mojoA cloud-only agent demonstrating how to expose native Mojo functions as tools (Function Calling) to a live LLM.
mojo -I src examples/example_3_tool_calling/example_tool_calling.mojoA cloud-only completions stream demonstrating real-time streaming token parsing and flushed printing.
mojo -I src examples/example_4_event_stream/example_event_stream.mojoA local performance benchmark executing parallel token classification on a hardware-accelerated GPU pipeline.
mojo -I src examples/example_5_gpu_analytics/example_gpu_analytics.mojoA concurrent web agent spawning parallel thread pools to fetch and sanitize multiple websites concurrently, then synthesizing research reports via Gemini 3.5 Flash.
mojo -I src examples/example_6_web_researcher/example_web_researcher.mojoA systems security auditor agent crawling files dynamically and extracting zero-copy StringView lifetimes slices to synthesize refactoring proposals.
mojo -I src examples/example_7_codebase_auditor/example_codebase_auditor.mojoAn autonomous systems-level coding agent running in a persistent loop (Plan -> Act -> Observe -> Repeat) that maintains session state history, executes system commands, and solves multi-step engineering tasks.
mojo -I src examples/example_8_long_running_coder/example_long_running_coder.mojo --interactiveA diagnostics checker that executes health queries and round-trip timing checks to verify the state of local LLM models on port 1234.
mojo -I src examples/example_9_local_heartbeat/example_local_heartbeat.mojoAn autonomous background-ticking daemon agent driven by a heartbeat clock that polls workspace states, monitors compilation status, patches error logs, and drives tasks to completion.
mojo -I src examples/example_10_full_fledged_agent/example_full_fledged_agent.mojo --interactiveAn autonomous systems agent using the v0.2 playbook package to match tasks against a local repository of successful command playbooks (Alignment), and synthesize new ones upon success (Extraction).
mojo -I src examples/example_11_playbook_agent/example_playbook_agent.mojo --interactiveAn autonomous systems agent using the v0.2 durable package to checkpoint its full state (messages, history, iteration index) to disk at every turn, enabling seamless recovery and completion after unexpected system crashes or restarts.
mojo -I src examples/example_12_durable_agent/example_durable_agent.mojo --interactiveAn autonomous systems agent implementing a basic Karpathy autoresearch loop (Propose -> Compile/Run -> Evaluate Metric -> Keep/Discard) to dynamically optimize a math compute kernel.
mojo run -I src examples/example_13_autoresearch/example_autoresearch.mojopi-mojo unifies compiled, high-performance systems logic with dynamic agent loops. High-level agent packages leverage low-level subprocess utilities and filesystem caching tools to achieve zero-overhead execution.
In v0.2, we introduced the Autonomous Playbook package (src/packages/playbook/) to enable agents to learn from successful executions and avoid trial-and-error, as well as the Durable Checkpointing package (src/packages/durable/) to enable resilient state recovery across process boundaries. Each of the examples is built around a concrete systems-level story narrative.
For complete technical implementation details, sequence diagrams of the execution, and the repository directory layout, refer to ARCHITECTURE.md.
For comprehensive, end-to-end systems engineering operations demonstrations, check out our dedicated Systems Storyboard Scenarios suite.
Instead of basic progressive API capability showcases, these scenarios are built around narrative-driven systems storyboards, including:
- Scenario 1: Onboarding Assistant - Environment checks and developer configs.
- Scenario 2: Git Sanitizer - Automated repo workspace untracked cleanup.
- Scenario 3: Thermal Monitor - Fast native thermodynamics tools.
- Scenario 4: Log Auditor - Real-time security events auditing stream.
- Scenario 5: GPU Benchmarker - Matrix multiplication latencies benchmarks.
- Scenario 6: Intel Aggregator - Multi-threaded release notes scrapers.
- Scenario 7: Lifecycle Leak Auditor - Zero-copy resource leaks scans.
- Scenario 8: Migration Assistant - Compilation diagnostic corrections.
- Scenario 9: Recovery Monitor - Service checks and failover playbooks.
- Scenario 10: CI Self-Healer Daemon - Autonomous background daemon.
- Scenario 11: Deep Research Agent - Multi-turn information gathering using multiple search APIs (Tavily, Exa, Brave, Google, Bing).
- Scenario 12: FlashInfer GPU Competition Optimizer - Closed-loop GPU kernel tuning cycle targeting FP8 MoE routing kernels for the MLSys 2026 contest.
For details on running these operations storyboards, see the Scenarios Hub README.
Licensed under the MIT License (refer to the LICENSE file for details).