Skip to content

urmzd/saige

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

180 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

saige

Super Artificial Intelligence Graph Environment
A unified Go SDK for streaming AI agents, knowledge graphs, and RAG pipelines.

Install · Report Bug · Go Docs

CI Go Reference License

Basic agent demo

Features

  • Streaming-first agent loop with typed delta events, parallel tool execution, and sub-agent delegation
  • Conversation tree with branching, checkpoints, rewind, and RLHF feedback
  • Knowledge graph construction with LLM-powered entity extraction, fuzzy dedup, and temporal tracking
  • Multi-retriever RAG fusing vector, BM25, and graph retrieval via Reciprocal Rank Fusion, with reranking and citations
  • 4 LLM providers (Ollama, OpenAI, Anthropic, Google) behind one Provider interface, with retry and fallback composition
  • MCP server exposing any saige tool pack to Claude Code, Codex, Gemini CLI, or any MCP client
  • Universal evaluation with composable scorers, A/B experiments, and LLM-as-judge

Why one SDK?

Agent orchestration, knowledge graphs, and RAG pipelines are deeply interconnected: RAG benefits from graph retrieval, agents need both for grounded responses, and all three share providers and embedders. saige unifies them under shared Provider, Embedder, and Tool interfaces, eliminating the wiring complexity of combining separate libraries.

Installation

Library

go get github.com/urmzd/saige

CLI and MCP server

go install github.com/urmzd/saige/cmd/saige@latest
go install github.com/urmzd/saige/cmd/saige-mcp@latest

Or install a pre-built saige binary:

curl -fsSL https://raw.githubusercontent.com/urmzd/saige/main/install.sh | sh

Quick Start

CLI

saige chat                                    # interactive multi-turn chat
saige ask "What is retrieval-augmented generation?"

# Serve saige tools to Claude Code, Codex, or Gemini CLI over MCP
saige-mcp --tools all --db "$SAIGE_DB" --searxng-url http://localhost:8080

The CLI auto-detects a provider from ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY, falling back to Ollama (no key needed). See the CLI reference for RAG/KG subcommands and flags.

Library

import (
    "github.com/urmzd/saige/agent"
    "github.com/urmzd/saige/agent/types"
    "github.com/urmzd/saige/agent/provider/ollama"
)

client := ollama.NewClient("http://localhost:11434", "qwen2.5", "nomic-embed-text")
a := agent.NewAgent(agent.AgentConfig{
    Name:         "assistant",
    SystemPrompt: "You are a helpful assistant.",
    Provider:     ollama.NewAdapter(client),
    Tools:        types.NewToolRegistry(myTool),
})

stream := a.Invoke(ctx, []types.Message{types.NewUserMessage("Hello!")})
for delta := range stream.Deltas() {
    switch d := delta.(type) {
    case types.TextContentDelta:
        fmt.Print(d.Content)
    }
}

See examples/ for runnable programs covering knowledge graphs, RAG pipelines, sub-agents, durability, and more.

Documentation

Each subsystem has its own README as the entrypoint for further information:

Package Documentation Covers
agent agent/README.md Providers, deltas, tools, sub-agents, markers, conversation tree, RLHF feedback, TUI, testing
knowledge knowledge/README.md Graph interface, hybrid search, deduplication, PostgreSQL backend, formatting
rag rag/README.md Data model, chunking, retrieval, reranking, HyDE, metrics, tool bindings
eval eval/README.md Scorers, A/B experiments, LLM-as-judge, stream timing, live eval harness (saige eval)
cmd/saige cmd/saige/README.md CLI reference: chat, ask, rag, kg, eval
cmd/saige-mcp cmd/saige-mcp/README.md MCP server setup for Claude Code, Codex, Gemini CLI
tools/research tools/research/README.md Web search, file, and knowledge graph tools
examples examples/README.md Runnable example index

API reference for every package: pkg.go.dev/github.com/urmzd/saige

Agent Skill

This repo's conventions are available as portable agent skills in skills/.

License

Apache 2.0. See LICENSE.

About

saige - Super Artificial Intelligence Graph Environment. A unified Go SDK, CLI, and MCP server for streaming AI agents, knowledge graphs, and RAG pipelines, with Ollama, OpenAI, Anthropic, and Google providers behind one interface.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors