Skip to main content

Grampus — Production-Grade Agentic AI Framework

PyPI Python License CI Coverage Downloads

As simple as CrewAI to start. As powerful as LangGraph for production.

Grampus is an open-source agentic AI framework built on Dapr's distributed runtime. It provides everything agents need to be production-ready — persistent memory, orchestration, safety guardrails, and full observability — while Dapr handles the hard infrastructure problems: durable state, pub/sub messaging, distributed locks, mTLS, and workflow checkpointing.


Why Grampus

  • Production memory architecture. Four complementary memory types (working, episodic, semantic, procedural) with SHA-256 provenance tracking, trust scoring, and injection detection. Memory poisoning attacks are blocked at write time, not detected after the fact.
  • Built-in safety, not bolted on. A multi-layer safety pipeline intercepts every LLM call, tool call, and memory write. Prompt injection detection, PII redaction, per-agent action boundaries, and configurable YAML policies ship in the box.
  • Dapr infrastructure means zero distributed-systems boilerplate. Swap your state backend from PostgreSQL to DynamoDB with a one-line YAML change. mTLS between agents is zero-configuration. Workflow checkpoints survive process crashes.

Features

Feature Description
🧠 Four memory types Working (token-aware, auto-summarized), episodic (cross-session, temporally decayed), semantic (SPO facts, confidence-weighted), procedural (learned workflows)
🔒 Memory security SHA-256 provenance on every write, trust scoring with temporal decay, injection detection, rate limiting, audit integrity verification
🔀 ReAct + Graph orchestration Async graph engine with conditional routing, parallel branches, and checkpoint/restore. Pre-built LLM, Tool, Human, Conditional, and Subgraph nodes
👥 Multi-agent crews Sequential, parallel, and hierarchical coordination. Distributed locks for shared state. Supervisor pattern with delegation
📊 15-assertion eval framework Contains, regex, tool assertions, JSON schema, LLM-as-judge, semantic similarity, PII/injection safety, cost/latency/step limits. A/B prompt testing, quality baselines
🛡️ Safety pipeline Multi-layer prompt injection detection (regex + heuristic, 3 strictness levels), PII detection for 6 entity types (log/redact/block), cost guards, action allowlists
📡 OTEL observability Six custom span types with model, token, cost, and duration attributes. Prometheus metrics endpoint. Immutable event log. Anomaly detection
📦 Sandboxed tool execution Docker container sandbox with resource limits and network isolation. Subprocess fallback for development. LLM-generated Python executes safely
🔌 MCP protocol support JSON-RPC 2.0 MCP client discovers and invokes any MCP-compatible tool server. External tool results tagged with provenance
CLI developer experience grampus init scaffolds a runnable project in under 10 seconds. grampus dev launches everything with hot-reload, live cost display, and trace streaming

Architecture

Grampus is organized in nine layers, each building on the one below it:

graph TD
    A[Dapr Runtime<br/>state · pub/sub · workflows · actors · mTLS · OTEL] --> B
    B[Core<br/>config · errors · logging · types · DI · model clients] --> C
    B --> D
    B --> E
    C[Memory<br/>working · episodic · semantic · procedural · security] --> F
    D[Tools<br/>registry · MCP client · sandbox · executor · boundaries] --> F
    E[Observability<br/>OTEL spans · Prometheus · event log · behavior monitor]
    F[Orchestration<br/>graph engine · model router · cost tracker · AgentRunner · Crew] --> G
    G[Safety<br/>injection detection · PII · action guard · YAML policies] --> H
    H[Evaluation<br/>eval suites · assertions · prompt versions · quality baselines] --> I
    I[CLI<br/>init · run · eval · memory · cost · dev]

Quickstart

Prerequisites: Python 3.12+, Docker, uv

# Install Grampus
pip install grampus-ai[anthropic]

# Scaffold a new project
grampus init hello-agent
cd hello-agent

# Start local infrastructure (Dapr + PostgreSQL + Redis)
docker compose up -d

Write your agent in agent.py:

import asyncio
import os

from grampus.core.models.anthropic import AnthropicClient
from grampus.core.types import AgentDefinition
from grampus.orchestration.runner import AgentRunner, RunnerConfig
from grampus.tools.executor import ToolExecutor
from grampus.tools.registry import ToolRegistry


def create_runner() -> AgentRunner:
    client = AnthropicClient(api_key=os.environ["GRAMPUS_MODEL__ANTHROPIC_API_KEY"])
    registry = ToolRegistry()

    # Register a tool with the decorator API
    @registry.tool(name="get_weather", description="Get the current weather for a city")
    async def get_weather(city: str) -> str:
        return f"Sunny, 22°C in {city}"  # replace with real API call

    executor = ToolExecutor(registry)
    config = RunnerConfig(max_iterations=5, enable_memory=True)
    return AgentRunner(model_client=client, tool_executor=executor, config=config)


def create_agent_def() -> AgentDefinition:
    return AgentDefinition(
        name="weather-agent",
        model="claude-sonnet-4-6",
        system_prompt="You are a helpful assistant. Use tools when needed.",
        tools=["get_weather"],
    )


async def main() -> None:
    runner = create_runner()
    agent = create_agent_def()

    result = await runner.run(agent, "What's the weather in Tokyo?", session_id="s1")
    print(f"Output: {result.output}")
    print(f"Cost:   ${result.token_usage.cost_usd:.6f}")


if __name__ == "__main__":
    asyncio.run(main())
# Run the agent
grampus run agent.py --input "What's the weather in Tokyo?"
# Output: The current weather in Tokyo is sunny with a temperature of 22°C.
# Cost:   $0.000021

Installation

# Core framework
pip install grampus-ai

# With Anthropic support (Claude)
pip install grampus-ai[anthropic]

# With OpenAI support (GPT-4o, o1)
pip install grampus-ai[openai]

# Both providers
pip install grampus-ai[all]

Using uv (recommended):

uv add grampus-ai[anthropic]

Requires Python 3.12 or 3.13. Dapr 1.17+ and Docker are required for memory persistence and sandboxed tool execution.


CLI

Command Description
grampus init <name> Scaffold a new agent project with infrastructure, config, and example code
grampus run <agent.py> Run an agent in interactive REPL mode or single-shot with --input
grampus eval <suite.py> Execute an evaluation suite; exit non-zero if pass rate falls below --fail-under
grampus memory inspect <agent_id> Display an agent's current memory state across all four memory types
grampus cost Show token usage and cost summary for recent sessions
grampus dev Start everything in watch mode with hot-reload, live cost tracking, and trace streaming

All commands support --help.


Documentation

Full documentation is at alireza1989.github.io/grampus:

See ROADMAP.md for what's shipped and what's next.


Contributing

We welcome contributions. Grampus is built with strict TDD — every change begins with a failing test.

See CONTRIBUTING.md for setup instructions, code conventions, the TDD requirement, conventional commit format, and guides for extending each layer of the framework.

Quick start for contributors:

git clone https://github.com/alireza1989/grampus
cd grampus-agentic-platform
uv sync
docker compose up -d
uv run pytest

License

Grampus is released under the MIT License.


Acknowledgements

Grampus stands on the shoulders of:

  • Dapr — the distributed application runtime that powers Grampus's infrastructure layer
  • Anthropic — for Claude and for advancing research into safe, capable AI systems
  • Model Context Protocol — the open standard for tool integration that Grampus implements
  • pgvector — PostgreSQL extension enabling vector similarity search without a separate database
  • Pydantic, structlog, OpenTelemetry — foundational libraries throughout the framework

Download files

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

Source Distribution

grampus_ai-0.2.0.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

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

grampus_ai-0.2.0-py3-none-any.whl (577.4 kB view details)

Uploaded Python 3

File details

Details for the file grampus_ai-0.2.0.tar.gz.

File metadata

  • Download URL: grampus_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for grampus_ai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 30e5f70d89d06929b82496dfcc2666bf30e8838ee40c65a29567a14c278fa743
MD5 b60dd3e89161c924223a934cadf6aed2
BLAKE2b-256 bc99ec1d55094821cb43db3f679c3738f0d6ef28aa111caf3cead0f058a96dcf

See more details on using hashes here.

Provenance

The following attestation bundles were made for grampus_ai-0.2.0.tar.gz:

Publisher: release.yml on alireza1989/grampus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grampus_ai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: grampus_ai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 577.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for grampus_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8712e33f3b595701a2195696b515870f90d49409910c5a3d82a4b956f77ec111
MD5 a311e1adb752575836d1ab40ae727f0f
BLAKE2b-256 a97aa3cef01f0f37440face9c970d365d5819695c5366d799442631025da63d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for grampus_ai-0.2.0-py3-none-any.whl:

Publisher: release.yml on alireza1989/grampus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page