stemedb/docs/references/go-adk
jml 9bfa626203 docs: reorganize documentation structure for clarity
Major documentation restructure to improve discoverability and reduce duplication.

## Changes

**Deleted (Archived/Consolidated)**:
- Removed duplicate getting started guides
- Archived outdated planning documents
- Consolidated corpus and configuration docs
- Removed obsolete vision/spec files (superseded by vision.md)
- Cleaned up scrapyard and old PDFs

**New Structure**:
- docs/about/ - Project overview and introduction
- docs/guides/ - User guides (moved from root)
- docs/specs/ - Technical specifications
- docs/sdk/ - SDK documentation (Go)
- docs/references/ - API references
- docs/archive/ - Archived historical docs
- applications/aphoria/docs/advanced/ - Advanced topics
- applications/aphoria/docs/reference/ - CLI reference
- applications/aphoria/docs/archive/ - Archived aphoria docs

**Updated**:
- README.md - New root README with clear navigation
- CONTRIBUTING.md - Contribution guidelines
- CLAUDE.md - Updated paths to new structure
- roadmap.md - Added recent completions

## Files Changed
- 57 files changed
- 1,977 insertions(+)
- 961 deletions(-)

**Net change**: +1,016 lines (added CONTRIBUTING.md, README.md, reorganized content)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 07:33:40 +00:00
..
agent-chatbot.md feat: Complete Phase 1 (The Spine) - storage foundation 2026-01-31 14:15:34 -07:00
agent-multi-chatters.md feat: Complete Phase 1 (The Spine) - storage foundation 2026-01-31 14:15:34 -07:00
agent-planning-facilitator.md feat: Complete Phase 1 (The Spine) - storage foundation 2026-01-31 14:15:34 -07:00
agent-researcher.md feat: Complete Phase 1 (The Spine) - storage foundation 2026-01-31 14:15:34 -07:00
agent-sales-agent.md feat: Complete Phase 1 (The Spine) - storage foundation 2026-01-31 14:15:34 -07:00
README.md docs: reorganize documentation structure for clarity 2026-02-11 07:33:40 +00:00
reference-guide.md feat: Complete Phase 1 (The Spine) - storage foundation 2026-01-31 14:15:34 -07:00
research.md feat: Complete Phase 1 (The Spine) - storage foundation 2026-01-31 14:15:34 -07:00

ADK-Go Reference Documentation

Google ADK-Go integration patterns and agent examples for Episteme.


Overview

The Google Agent Development Kit (ADK) for Go enables building AI agents that can use tools to interact with external systems. These guides show how to integrate ADK-Go agents with Episteme for knowledge graph-powered AI applications.


Core Reference


Agent Examples

Basic Agents

  • Chatbot Agent - Simple conversational agent with Episteme integration
  • Sales Agent - Sales automation with knowledge graph lookups

Advanced Agents


Key Concepts

Tool Integration

ADK-Go agents use "tools" to interact with Episteme:

// Query knowledge graph
func QueryKnowledge(ctx context.Context, subject, predicate string, lens string) (string, error) {
    resp, err := episteme.Query(ctx, &QueryParams{
        Subject:   subject,
        Predicate: predicate,
        Lens:      lens,
    })
    return formatForAgent(resp), nil
}

// Assert new facts
func AssertFact(ctx context.Context, subject, predicate, object string) error {
    return episteme.Assert(ctx, &AssertionRequest{
        Subject:    subject,
        Predicate:  predicate,
        Object:     ObjectText(object),
        Confidence: 0.9,
    })
}

Agent Patterns

  1. Query-First: Agents query Episteme before making decisions
  2. Claim-Backed: Agents cite sources from knowledge graph
  3. Conflict-Aware: Agents surface disagreement instead of hiding it
  4. Auditable: All agent queries tracked in audit trail

Integration Guide

Prerequisites

go get google.golang.org/genai
go get github.com/orchard9/stemedb-go/steme

Basic Setup

import (
    "google.golang.org/genai"
    "github.com/orchard9/stemedb-go/steme"
)

// Initialize Episteme client
signer, _ := steme.GenerateSigner()
episteme := steme.NewClient("http://localhost:18180", signer)

// Create agent with tools
agent := genai.NewAgent(
    genai.WithModel("gemini-2.0-flash"),
    genai.WithTools(
        QueryKnowledgeTool(episteme),
        AssertFactTool(episteme),
    ),
)

→ Full Integration Guide


Use Cases

Agent Type Use Case Example
Chatbot Customer support with knowledge base Answer questions with cited sources
Researcher Literature review and synthesis Track conflicting studies, surface disagreement
Sales Agent Lead qualification and outreach Query customer history, log interactions
Planning Facilitator Project planning and coordination Track decisions, maintain context across sessions
Multi-Chatters Multi-agent collaboration Agents share knowledge graph, resolve conflicts

Best Practices

1. Query Before Assert

Always query existing knowledge before creating new assertions:

// Check if fact already exists
existing, _ := episteme.Query(ctx, &QueryParams{
    Subject: subject,
    Predicate: predicate,
})

if existing.Winner == nil {
    // No existing fact, safe to assert
    episteme.Assert(ctx, assertion)
}

2. Use Appropriate Lenses

Choose the right lens for your use case:

  • Consensus: General queries where majority view matters
  • Recency: Real-time data (prices, status)
  • Authority: Regulatory or official information
  • Skeptic: Research where disagreement is valuable

3. Include Confidence Scores

Always include confidence when asserting:

assertion := steme.NewAssertion(subject, predicate).
    WithString(value).
    WithConfidence(0.85).  // Be explicit about certainty
    Build()

4. Track Agent Identity

Use agent-specific keys for audit trail:

// Each agent has its own signer
agentSigner, _ := steme.LoadSigner("agent-key.pem")
client := steme.NewClient(endpoint, agentSigner)

Testing

Mock Episteme

Use test doubles for unit testing:

type MockEpisteme struct {
    assertions map[string]*Assertion
}

func (m *MockEpisteme) Query(ctx, params) (*QueryResult, error) {
    // Return test data
}

func (m *MockEpisteme) Assert(ctx, assertion) (string, error) {
    // Track assertions for verification
}

Integration Tests

Test against real Episteme instance:

func TestAgentIntegration(t *testing.T) {
    // Start test Episteme instance
    episteme := startTestInstance(t)
    defer episteme.Shutdown()

    // Run agent
    result := agent.Run(ctx, "Test query")

    // Verify assertions created
    assertions := episteme.GetAssertions()
    assert.Len(t, assertions, 1)
}

Resources


See Also


← Back to Documentation Index