Skip to content

Ravi Agent Framework

You want to build an AI agent. Not a chatbot that wraps a single API call, but a real one — one that can call tools, remember what it said three conversations ago, wait for a human to approve a sensitive action, recover from crashes, and scale across workers when you need it to.

That is what Ravi is for.

  • Start in 5 minutes


    Install the framework, create your first agent, run it against an OpenAI model, and understand what the runtime is doing behind the scenes.

    Getting Started

  • Understand the architecture


    Six clean layers, each building on the one below. The kernel defines contracts. The fabric routes messages. Reasoning runs the ReAct loop. Orchestration coordinates fleets.

    Layered Architecture

  • Build with tools and HITL


    Add custom tools, wire up human-in-the-loop approvals, and connect MCP servers using the same patterns the built-in tools follow.

    Tutorials

  • Ship durable agents


    Move from an in-process agent to a runtime-backed deployment where every step is checkpointed and resumable after a crash.

    Durable Runtime

  • Operate in production


    Run locally, deploy with Docker or Kind, and inspect structured logs, distributed traces, and metrics with the built-in observability stack.

    Operate


The story in one picture

Every request follows the same path — from a client request, through the durable runtime queue, executing the ReAct loop, calling tools, and returning the result.

Agent Architecture Diagram

The key insight: the caller never holds a reference to the agent. It sends a message to an address (AgentId). The runtime delivers it. Whether the agent is in the same process, a remote gRPC node, or a Kubernetes pod does not change the call site.


Kernel Architecture

The kernel defines the core protocols, messages, tools, memory, and guardrails, all building upon a durable Runtime substrate:

Kernel Modular Architecture


Developer journey

  1. Read Installation and run Quickstart — you will have a working agent in under ten minutes.
  2. Understand why the actor model matters in Agent Lifecycle and Streaming and Events.
  3. Extend the system with Create a Tool and Connect MCP Tools.
  4. Read The Kernel when you are ready to understand the contracts everything is built on.
  5. Move to the durable flow in First Durable Run and Local and Kind.
  6. Use Observability and Runbook when debugging in production.

Installation

git clone https://github.com/Ravikumarchavva/ravi.git
cd ravi/ravi-engine
uv sync
# Notebook support
uv sync --group notebooks

# Browser automation (WebSurferTool)
uv sync --group browser

# S3 / object storage
uv sync --group storage

Your first agent

import asyncio
from ravi.config import settings
from ravi.agents import ReActAgent, Runtime
from ravi.agents.context import ContextConfig, InMemoryHistoryProvider
from ravi.integrations.llm import LLMFactory
from ravi.capabilities.tools import CalculatorTool


async def main() -> None:
    # 1. Initialize the LLM client
    model = LLMFactory(settings.CHAT_MODEL, settings.OPENAI_API_KEY).build()

    # 2. Construct the agent with custom capabilities and tools
    agent = ReActAgent(
        "helper",
        model=model,
        tools=[CalculatorTool()],
        context=ContextConfig(InMemoryHistoryProvider()),
        system_instructions="You are a helpful assistant.",
    )

    # 3. Start the runtime, register the agent, and run the interactive console
    async with Runtime() as rt:
        await rt.register(agent)

        # 4. Use the built-in Console REPL to talk to the agent
        from ravi.console import Console
        console = Console(agent, runtime=rt)
        await console.interactive(stream=True)


if __name__ == "__main__":
    asyncio.run(main())

The shape stays the same whether you add tools, guardrails, streaming, HITL approvals, or swap in a distributed runtime. The call site does not change — only the configuration does.


Architecture at a glance

L0

Kernel Contracts

Universal primitives and interface definitions. Pure contracts with absolutely zero external I/O, forming the foundational type system of the engine.

Protocols ContentBlock AgentId SignalBus
L1

Fabric Layer

Durable actor execution and message routing. Coordinates prioritize-scheduling, agent inboxes, supervision tree topology, and Saga-based rollbacks.

Inbox Scheduler EventLog Sagas
L2

Reasoning & Agents

Autonomous reasoning core. Drives the central ReAct step execution loops, context history providers, model routing, and safety middleware hooks.

ReActAgent Memory LLMRouter Hooks
L3

Orchestration Workflows

Multi-agent orchestrations. Manages agent-to-agent handoffs, parallel execution graphs, collaborative state, and team sub-routing.

Workflows Handoffs Orchestrator
L4

Guardrails & Governance

System safety gates. Enforces runtime execution budget limits, structural input/output mutations, policies, and global kill-switches.

Budgets MutationGates Kill-Switch
L5

Platform & Operations

Scaling and deployment utilities. Supports persistent DB backends (Postgres/Redis), telemetry (OTel), benchmarks, and cron triggers.

PostgresRT OTel Tracing Evals RAG Pipelines

Higher layers may import from lower ones. The reverse is never allowed. uv run lint-imports enforces this structural integrity in CI.


Features

  • Actor-model agents — every agent has an address, receives messages, and communicates only through the runtime.
  • Human-in-the-loop approvals and structured human input flows, pausable and resumable.
  • Tool calling with JSON-schema validation, risk tiers, and MCP server integration.
  • Async-first across agents, tools, memory, and every service boundary.
  • Streaming responses and event-driven UI updates over SSE.
  • Built-in observability: structured logs, OpenTelemetry traces, Grafana dashboards.
  • Multiple deployment paths: local monolith, Docker Compose, and Kind/Kubernetes.
  • Example notebooks covering foundations, memory, MCP tools, safety, runtime, and observability.

Examples

Explore the examples/ folder for notebooks covering everything from a single-tool agent to Kubernetes deployments.

For architecture deep-dives and the full kernel contract reference, see The Kernel and Layered Architecture.