Skip to main content

Build, benchmark, and package local SLM agents. No API keys, no cloud.

Project description

OnsetLab

Make your local SLMs do actual work.

What

Agent framework for small language models (3B parameters) that achieves GPT-4 level tool use on your laptop. Uses REWOO architecture (plan → execute → verify) with ReAct fallback for robustness.

  • No API keys - runs entirely on Ollama
  • No fine-tuning - works out of the box with any Ollama model
  • MCP support - connect to any MCP-compatible server
  • Package & Deploy - export as Docker, config, or standalone script

Install

pip install onsetlab

Requires Ollama running locally.

Quick Start

from onsetlab import Agent

agent = Agent("phi3.5")
result = agent.run("What time is it in Tokyo?")
print(result.answer)

Adding Tools

Choose only the tools you need:

from onsetlab import Agent
from onsetlab.tools import Calculator, DateTime, UnitConverter, TextProcessor, RandomGenerator

agent = Agent(
    model="phi3.5",
    tools=[Calculator(), DateTime()]
)

result = agent.run("What's 15% tip on $84.50?")
print(result.answer)  # "The 15% tip on $84.50 is $12.68"

Available built-in tools:

  • Calculator - math operations
  • DateTime - current time, timezones, date math
  • UnitConverter - convert between units
  • TextProcessor - word count, search, transform text
  • RandomGenerator - random numbers, strings, choices

MCP Servers

Connect to external services via Model Context Protocol:

from onsetlab import Agent, MCPServer

agent = Agent("phi3.5")

# Add filesystem access
agent.add_mcp_server(MCPServer.from_registry("filesystem", path="/my/project"))

# Add GitHub integration
agent.add_mcp_server(MCPServer.from_registry("github", token="ghp_..."))

result = agent.run("List all Python files in the project")
print(result.answer)

Registry servers: filesystem, github, slack, notion, google_calendar, tavily

Or configure any MCP server manually:

server = MCPServer(
    name="my-server",
    command="npx",
    args=["-y", "@some/mcp-server"],
    env={"API_KEY": "..."}
)
agent.add_mcp_server(server)

Packaging & Deployment

Export your agent for deployment:

# Export as Docker (includes docker-compose with Ollama)
agent.export("docker", "./my_agent/")

# Export as config file
agent.export("config", "my_agent.yaml")

# Export as standalone script
agent.export("binary", "my_agent.py")

Or via CLI:

python -m onsetlab export --format docker --output ./deployment/
cd deployment && docker-compose up --build

See docs/PACKAGING.md for full deployment guide.

Benchmarking

Compare model performance on tool-calling:

# Benchmark single model
python -m onsetlab benchmark --model phi3.5

# Compare models
python -m onsetlab benchmark --compare "phi3.5,qwen2.5:3b,llama3.2:3b"

See specs/BENCHMARKING.md for methodology.

Architecture

Task → Router → Strategy Selection
                    ↓
         ┌─────────┼─────────┐
         ↓         ↓         ↓
      DIRECT    REWOO     REACT
         ↓         ↓         ↓
                   └─────────┘
                       ↓
                   Verifier → Solver → Answer
  1. Router - selects optimal strategy (DIRECT/REWOO/REACT)
  2. Planner - creates step-by-step execution plan (REWOO)
  3. Verifier - validates plan before execution
  4. Executor - runs tools with dependency resolution
  5. Solver - synthesizes final answer from results
  6. ReAct fallback - recovers from planning failures

Options

agent = Agent(
    model="phi3.5",           # any Ollama model
    tools=[...],              # built-in tools
    mcp_servers=[...],        # MCP servers
    memory=True,              # conversation memory
    verify=True,              # pre-execution verification
    routing=True,             # intelligent strategy selection
    react_fallback=True,      # fallback on REWOO failure
    debug=False               # verbose logging
)

License

Apache 2.0

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

onsetlab-0.1.0.tar.gz (83.6 kB view details)

Uploaded Source

Built Distribution

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

onsetlab-0.1.0-py3-none-any.whl (87.3 kB view details)

Uploaded Python 3

File details

Details for the file onsetlab-0.1.0.tar.gz.

File metadata

  • Download URL: onsetlab-0.1.0.tar.gz
  • Upload date:
  • Size: 83.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for onsetlab-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56cda012708a3f0f6c443ff25749b1ae37e61b16ca4aa15ae014d78c8472628e
MD5 b65d171dfbc2afa85ef416c077a3039f
BLAKE2b-256 b4726675bf323fd1743bd2e5310cb248831b4ac60b53f405868ad4b87312cd29

See more details on using hashes here.

File details

Details for the file onsetlab-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: onsetlab-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 87.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for onsetlab-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52548ddfdb9acc254b501f11b2008e4b2fffddbe530bbdc66345874c93a5eff6
MD5 7c85e08ee2cfb06ad01585445977e74d
BLAKE2b-256 656184007015a8033f34467ec86f71b94f0d63fcda70a1de95d8d508939fbbe9

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