canto

module
v0.0.0-...-244f9da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2026 License: Apache-2.0

README

Canto

Go Reference

Canto is a Go framework for building durable agent backends. It provides primitives for append-only session history, phased context construction, and multi-agent coordination.

[!WARNING] Status: Pre-alpha. Canto is under active development. APIs are unstable and subject to breaking changes.

Features

  • Append-only log: Every interaction, tool call, and compaction is recorded as a permanent fact.
  • Durable Sessions: JSONL or SQLite (FTS5) backends for session persistence and search.
  • Phased Context: Separate request building (preview) from state mutation (commit).
  • Subagent Primitives: Spawn, monitor, and export child agent runs with linked history.
  • MCP Support: Integration with the Model Context Protocol for tool discovery.
  • Context Governance: Automated offloading and summarization via the governor package.

Installation

go get github.com/nijaru/canto

Quick Start

package main

import (
	"context"
	"fmt"

	"github.com/nijaru/canto/agent"
	"github.com/nijaru/canto/llm/providers/anthropic"
	"github.com/nijaru/canto/session"
)

func main() {
	ctx := context.Background()
	p := anthropic.NewProvider(...) // requires API key

	// 1. Define an agent
	a := agent.New("assistant", "You are a helpful gopher.", "claude-3-5-sonnet", p, nil)

	// 2. Start a session
	sess := session.New("user-session-id")

	// 3. Execute a turn
	res, _ := a.Turn(ctx, sess)
	fmt.Println(res.Content)
}

Packages

Package Description Status
llm Provider normalization and token tracking Semi-stable
session Append-only event log and storage Semi-stable
agent Core turn-based loops Active
runtime Coordinator and runner execution Active
governor Context offloading and guards New
safety Execution modes and tool gating New
artifact Blob storage and registry Semi-stable
x/ Swarm, Graph, and evaluation patterns Experimental

Examples

License

MIT

Directories

Path Synopsis
Package agent provides the turn-based agent loop over durable sessions.
Package agent provides the turn-based agent loop over durable sessions.
Package approval provides a transport-agnostic approval bridge for pausing framework operations until a host explicitly allows or denies them.
Package approval provides a transport-agnostic approval bridge for pausing framework operations until a host explicitly allows or denies them.
Package artifact provides durable artifact descriptors and pluggable storage.
Package artifact provides durable artifact descriptors and pluggable storage.
Package context builds model requests from durable session state.
Package context builds model requests from durable session state.
examples
long-horizon command
long-horizon demonstrates Canto's automated context governance.
long-horizon demonstrates Canto's automated context governance.
subagents command
subagents demonstrates Canto's core orchestration primitives for managing multi-agent workflows.
subagents demonstrates Canto's core orchestration primitives for managing multi-agent workflows.
Package hook executes lifecycle hooks around sessions and tool use.
Package hook executes lifecycle hooks around sessions and tool use.
llm
Package llm defines Canto's provider-agnostic model interface.
Package llm defines Canto's provider-agnostic model interface.
Package memory provides long-term memory orchestration plus the underlying storage implementations used to persist it.
Package memory provides long-term memory orchestration plus the underlying storage implementations used to persist it.
Package runtime executes agents against durable sessions.
Package runtime executes agents against durable sessions.
Package session provides Canto's durable append-only conversation log.
Package session provides Canto's durable append-only conversation log.
Package skill integrates the standalone github.com/nijaru/agentskills module with Canto's tool and context surfaces.
Package skill integrates the standalone github.com/nijaru/agentskills module with Canto's tool and context surfaces.
Package tool defines executable tool contracts and registry helpers.
Package tool defines executable tool contracts and registry helpers.
mcp
Package mcp exposes Canto tools over the Model Context Protocol and adapts remote MCP tools back into Canto's tool registry.
Package mcp exposes Canto tools over the Model Context Protocol and adapts remote MCP tools back into Canto's tool registry.
Package workspace provides symlink-safe rooted filesystem access for workspace-aware agents and hosts.
Package workspace provides symlink-safe rooted filesystem access for workspace-aware agents and hosts.
x
eval
Package eval provides an evaluation harness for scoring agent trajectories.
Package eval provides an evaluation harness for scoring agent trajectories.
graph
Package graph provides deterministic DAG orchestration for multi-agent pipelines.
Package graph provides deterministic DAG orchestration for multi-agent pipelines.
obs
Package obs provides OpenTelemetry instrumentation for canto agents.
Package obs provides OpenTelemetry instrumentation for canto agents.
pool
Package pool provides a bounded worker pool for the Slate orchestrator pattern: dispatch N tasks to M agents in parallel, collect distilled episodes.
Package pool provides a bounded worker pool for the Slate orchestrator pattern: dispatch N tasks to M agents in parallel, collect distilled episodes.
redis
Package redis provides a Redis-backed Coordinator for distributed per-session lane coordination across multiple processes.
Package redis provides a Redis-backed Coordinator for distributed per-session lane coordination across multiple processes.
swarm
Package swarm provides decentralized multi-agent coordination via a shared blackboard.
Package swarm provides decentralized multi-agent coordination via a shared blackboard.
testing
Package testing provides test utilities for agents built with canto.
Package testing provides test utilities for agents built with canto.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL