Skip to content

atveit/pi-mojo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

pi-mojo πŸ€–

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.


πŸš€ Getting Started

Prerequisites

Ensure you have the Modular Mojo compiler installed:

mojo --version

Running Examples

The 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.mojo

A 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.mojo

A 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.mojo

A cloud-only completions stream demonstrating real-time streaming token parsing and flushed printing.

mojo -I src examples/example_4_event_stream/example_event_stream.mojo

A local performance benchmark executing parallel token classification on a hardware-accelerated GPU pipeline.

mojo -I src examples/example_5_gpu_analytics/example_gpu_analytics.mojo

A 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.mojo

A 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.mojo

An 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 --interactive

A 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.mojo

An 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 --interactive

An 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 --interactive

An 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 --interactive

An 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.mojo

πŸ—οΈ High-Level System Architecture

pi-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.

🎭 Real-World Systems Scenarios

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:

For details on running these operations storyboards, see the Scenarios Hub README.


πŸ›‘οΈ License

Licensed under the MIT License (refer to the LICENSE file for details).

About

A mojo port of the PI AI Agent Toolkit

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors