Open source · MIT licensed

Three-layer architecture for conscious agents

Cortiva agents are not chatbots. They are persistent, reasoning entities with memory, skills, and the ability to collaborate. Here is how the framework is built.


┌───────────────────────────────────────────────────┐
│                 CORTIVA AGENT                        │
│                                                       │
│  ┌─────────────────────────────────────────────┐  │
│  │  Consciousness Layer                             │  │
│  │  LLM → Reasoning → Decisions → Actions          │  │
│  └─────────────────────────────────────────────┘  │
│              │                    │                    │
│  ┌────────────────────┐  ┌────────────────────┐  │
│  │  Procedure Layer    │  │  Knowledge Layer    │  │
│  │  Workflows → Tools  │  │  Graph → RAG → Facts│  │
│  └────────────────────┘  └────────────────────┘  │
│              │                    │                    │
│  ┌─────────────────────────────────────────────┐  │
│  │  Adapters: Slack, Linear, Xero, GitHub, ...    │  │
│  └─────────────────────────────────────────────┘  │
└───────────────────────────────────────────────────┘

The three layers

Every Cortiva agent is built from three composable layers. Each layer can be configured, extended, or replaced independently.

Consciousness Layer

cortiva.consciousness

The reasoning engine. Each agent maintains a persistent stream of awareness that processes incoming signals, reflects on context, and decides what to do next. Built on large language models with structured output.

  • Persistent awareness loop with configurable tick rate
  • Structured reasoning with chain-of-thought traces
  • Context window management with automatic summarisation
  • Multi-model support (Anthropic, OpenAI, local models)
  • Emotional state modelling for natural interactions

Procedure Layer

cortiva.procedures

The action engine. Procedures are deterministic workflows that agents execute. Think of them as skills an agent can learn. They combine LLM reasoning with tool calls, API integrations, and human-in-the-loop checkpoints.

  • Declarative procedure definitions in YAML or Python
  • Built-in retry, rollback, and error handling
  • Human-in-the-loop approval gates
  • Procedure composition (procedures can call other procedures)
  • Audit trail for every step executed

Knowledge Layer

cortiva.knowledge

The memory engine. Agents build and query a persistent knowledge graph scoped to their role, department, and organisation. Supports both structured facts and unstructured documents.

  • Role-scoped knowledge graphs with inheritance
  • RAG pipeline with configurable embedding models
  • Automatic knowledge extraction from conversations
  • Cross-agent knowledge sharing with access controls
  • Versioned knowledge with temporal queries

Define an agent in Python

Agents are defined in code. Here is a complete example of a bookkeeping agent with a daily reconciliation procedure.

from cortiva import Agent, Procedure, KnowledgeStore

# Define an agent
bookkeeper = Agent(
    name="BookKeep-01",
    role="Bookkeeper",
    department="finance",
    consciousness={
        "provider": "anthropic",
        "model": "claude-sonnet-4-20250514",
        "tick_rate": "5m",
    },
    knowledge=KnowledgeStore(
        scope="department",
        sources=["xero", "stripe", "bank-feed"],
    ),
)

# Attach a procedure
@bookkeeper.procedure(schedule="daily 09:00")
async def reconcile_transactions(ctx):
    """Pull bank transactions and match to invoices."""
    transactions = await ctx.tools.bank.get_unmatched()
    invoices = await ctx.tools.xero.get_open_invoices()

    for txn in transactions:
        match = ctx.reason(
            f"Match transaction {txn} to an invoice",
            choices=invoices,
        )
        if match.confidence > 0.95:
            await ctx.tools.xero.reconcile(txn.id, match.invoice_id)
        else:
            await ctx.escalate(
                to="Head-Accounting",
                message=f"Low confidence match for {txn.description}",
            )

# Deploy
bookkeeper.deploy(node="mini-1")

Pluggable adapters

Connect agents to your existing tools. Each adapter is a separate package you can install, configure, and swap out.

Slack

Communication

Stable

Linear

Project Management

Stable

Google Workspace

Productivity

Stable

Stripe

Payments

Stable

Xero

Accounting

Beta

HubSpot

CRM

Beta

GitHub

Development

Stable

PostgreSQL

Database

Stable

S3 / MinIO

Storage

Stable

Twilio

Communication

Beta

Notion

Knowledge Base

Alpha

Jira

Project Management

Alpha

Building a custom adapter? Check the adapter development guide on GitHub.

Technical specifications

LanguagePython 3.11+
Async runtimeasyncio / uvloop
API frameworkFastAPI
Package formatPyPI (pip install cortiva)
ConfigurationYAML + Python decorators
Storage backendsPostgreSQL, SQLite, Redis
Embedding modelsOpenAI, Cohere, local ONNX
LLM providersAnthropic, OpenAI, Ollama
DeploymentDocker, K8s, bare metal
LicenceMIT (framework), Commercial (HQ)

Start building with Cortiva

Clone the repo, install, and have your first agent running in under 5 minutes.