Skip to main content

Lightweight agent runtime library for autonomous edge agents

Project description

OpenHoof v2.0

Standalone agent runtime library for autonomous LLM agents โ€” runs on-device, no server required.

PyPI version Python 3.10+ License: Apache 2.0


v1 was a FastAPI server. WebSockets, session management, a CLI, a UI, a gateway. You needed it running somewhere reachable to use it.

v2 is a library. pip install openhoof. Import it. Your agent runs anywhere โ€” laptop, phone, edge device, Rust daemon.


Install

pip install openhoof

Or from source:

git clone https://github.com/llama-farm/openhoof.git
cd openhoof
pip install -e .

Quick Start

from openhoof import Agent, bootstrap_agent, get_builtin_tool_schemas, create_tool_schema

# 1. Create a complete agent workspace (SOUL.md, MEMORY.md, HEARTBEAT.md, etc.)
bootstrap_agent(
    workspace="./my-agent",
    name="MyBot",
    emoji="๐Ÿค–",
    mission="Your mission here",
    user_name="Rob",
    timezone="America/Chicago"
)

# 2. Define your tools (OpenAI-compatible format)
my_tool = create_tool_schema(
    name="get_status",
    summary="Get current system status",
    parameters={"type": "object", "properties": {"system": {"type": "string"}}, "required": ["system"]}
)

def my_executor(tool_name: str, params: dict) -> dict:
    if tool_name == "get_status":
        return {"status": "operational", "uptime": "4h"}
    return {"error": "unknown tool"}

# 3. Run the agent โ€” it chains tool calls autonomously until the task is done
agent = Agent(
    soul="./my-agent/SOUL.md",
    memory="./my-agent/MEMORY.md",
    tools=get_builtin_tool_schemas() + [my_tool],
    executor=my_executor,
    workspace="./my-agent",
    max_turns=10
)

response = agent.reason("Check system status and log the result")
print(response)

How It Works

agent.reason(prompt) runs a multi-turn loop โ€” the LLM decides which tools to call, executes them, feeds results back in, and repeats until the task is complete:

Turn 1: LLM โ†’ call get_status("server") โ†’ "operational, 4h uptime"
Turn 2: LLM โ†’ call log("Server operational") โ†’ logged to memory
Turn 3: LLM โ†’ no more tool calls โ†’ "Server is operational. Uptime: 4h. Logged."

max_turns is configurable at init or per-call:

agent = Agent(..., max_turns=20)
response = agent.reason("complex task", max_turns=5)  # per-call override

Built-in Tools

Every agent gets 10+ built-in tools automatically โ€” no extra setup:

Tool What it does
memory_search(query) Semantic search across MEMORY.md
memory_append(text) Append to daily memory log
memory_read() Read full MEMORY.md
get_time() Current timestamp
log(msg, level) Structured log with emoji levels
save_state(key, value) Persist state across sessions
load_state(key) Restore saved state
mission_start(id, goal) Start mission with fresh context
checkpoint(summary) Save progress mid-mission
mission_complete(summary) Archive mission + clear context
read_soul() Load SOUL.md on demand
read_user() Load USER.md on demand
read_agents() Load AGENTS.md on demand
read_tool_guide(tool) Load tool-specific guidance

Token Budget Strategy

Mobile models have 2,048 tokens total. Loading all context upfront wastes most of it.

OpenHoof keeps the system prompt to ~200 tokens (SOUL.md core only). Everything else lazy-loads via built-in tools when the agent actually needs it:

memory_search("last waypoint altitude")   # 3 snippets, ~80 tokens
read_tool_guide("drone_goto")             # tool guidance on-demand

Result: 95% of context window available for actual work.


LlamaFarm Integration

Configure your models in llamafarm.yaml:

llamafarm:
  endpoint: "http://localhost:11540/v1"

models:
  router:
    model: "functiongemma"       # Fast tool routing (<300ms)
  reasoning:
    model: "unsloth/Qwen3-1.7B-GGUF"  # Agentic loop
  mobile:
    model: "llama3.2:1b"         # On-device (phone)
  fallback:
    model: "gpt-4o-mini"         # Cloud fallback

DDIL Support

Built for offline-first operation โ€” Denied, Degraded, Intermittent, Limited networks:

  • Store-and-forward: Data buffers locally when offline, syncs when connectivity returns
  • Local model fallback: Agent loop continues with on-device models during outages
  • Checkpoint/resume: Mission progress saved so agents recover from crashes
from openhoof import Agent, DDILBuffer

agent = Agent(..., ddil_enabled=True)
agent.run()  # Keeps running even when network drops

FunctionGemma Training Pipeline

Fine-tune a 270M parameter model to route tool calls with >99% accuracy in <300ms.

Every tool call the agent makes is automatically captured as JSONL training data:

# Check captured training data
python -m training.pipeline status

# Fine-tune FunctionGemma on your captured data
python -m training.pipeline run

# Export for deployment
python -m training.pipeline export

Run missions โ†’ capture data โ†’ fine-tune โ†’ your router learns your exact domain.


Repo Structure

openhoof/               # Library (pip install openhoof)
โ”œโ”€โ”€ agent.py            # Core Agent class + reasoning loop
โ”œโ”€โ”€ soul.py             # SOUL.md loading โ†’ system prompt
โ”œโ”€โ”€ memory.py           # MEMORY.md + semantic search
โ”œโ”€โ”€ heartbeat.py        # Heartbeat + exit conditions
โ”œโ”€โ”€ events.py           # Event queue
โ”œโ”€โ”€ ddil.py             # Store-and-forward buffer
โ”œโ”€โ”€ training.py         # Training data capture (JSONL)
โ”œโ”€โ”€ models.py           # LlamaFarm model integration
โ”œโ”€โ”€ tool_registry.py    # Tool registration + execution
โ”œโ”€โ”€ bootstrap.py        # Workspace bootstrapping
โ””โ”€โ”€ builtin_tools/      # 10+ built-in agent tools

training/               # FunctionGemma fine-tuning pipeline
โ”œโ”€โ”€ pipeline.py         # Training orchestration
โ””โ”€โ”€ train_tool_router.py

examples/               # Example agent configs
โ”œโ”€โ”€ basic-agent/
โ”œโ”€โ”€ drone-agent/
โ”œโ”€โ”€ fuel-analyst/
โ”œโ”€โ”€ orchestrator/
โ””โ”€โ”€ customer-support/

docs/                   # Design docs
tests/                  # Test suite

Roadmap

  • Phase 2 (now): Pure Kotlin Android โ€” direct DJI SDK + ONNX Runtime, no React Native
  • Phase 3: Rust core with JNI/PyO3 bindings โ€” same runtime, any platform

License

Apache 2.0 โ€” see LICENSE

Built by LlamaFarm

Project details


Download files

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

Source Distribution

openhoof-2.1.6.tar.gz (816.4 kB view details)

Uploaded Source

Built Distribution

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

openhoof-2.1.6-py3-none-any.whl (54.9 kB view details)

Uploaded Python 3

File details

Details for the file openhoof-2.1.6.tar.gz.

File metadata

  • Download URL: openhoof-2.1.6.tar.gz
  • Upload date:
  • Size: 816.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for openhoof-2.1.6.tar.gz
Algorithm Hash digest
SHA256 6060e275ad7cd462d45235211b06c7abef83b1826ac5491734e4e97b33f4ffee
MD5 671d4b78ac240e471d169789eb60d800
BLAKE2b-256 037bd6b326b277fd93e34b9824a6ddb779288ad779344d686306719b7bbb5b15

See more details on using hashes here.

File details

Details for the file openhoof-2.1.6-py3-none-any.whl.

File metadata

  • Download URL: openhoof-2.1.6-py3-none-any.whl
  • Upload date:
  • Size: 54.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for openhoof-2.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fda498925b5ad6040cacbf1e549d3ab2b31bc29f19f5c10c15c3b3bc7293cb41
MD5 b735fedf928a4e144d30cd827018c8fc
BLAKE2b-256 65d409c931b44aeccaf0735c82e11b93e910911698d1ad41b484adbb3839e92a

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