Skip to main content

Crate ucp_agent

Crate ucp_agent 

Source
Expand description

Agent Graph Traversal System for UCP Knowledge Graphs

This crate provides a powerful, flexible graph traversal system enabling AI agents to navigate knowledge graphs, search semantically, manage context windows, and coordinate parallel exploration.

§Features

  • UCL Commands: Traversal commands (GOTO, EXPAND, FOLLOW, etc.) and context commands (CTX ADD, CTX REMOVE, etc.) for agent-friendly graph navigation.
  • Session Management: Track agent position, history, and state across operations.
  • RAG Integration: Pluggable semantic search providers for knowledge retrieval.
  • Safety Mechanisms: Limits, circuit breakers, and depth guards for robust operation.
  • Observability: Comprehensive metrics and telemetry for monitoring.

§Example

use ucp_agent::{AgentTraversal, SessionConfig};
use ucm_core::Document;

// Create traversal system
let doc = Document::new();
let traversal = AgentTraversal::new(doc);

// Create a session
let session_id = traversal.create_session(SessionConfig::default())?;

// Execute UCL commands
traversal.execute_ucl(&session_id, "GOTO blk_abc123")?;
traversal.execute_ucl(&session_id, "EXPAND blk_abc123 DOWN DEPTH=3")?;
traversal.execute_ucl(&session_id, "CTX ADD RESULTS")?;

Re-exports§

pub use cursor::CursorNeighborhood;
pub use cursor::TraversalCursor;
pub use cursor::ViewMode;
pub use error::AgentError;
pub use error::AgentSessionId;
pub use error::Result;
pub use executor::execute_ucl;
pub use executor::ExecutionResult;
pub use executor::UclExecutor;
pub use metrics::MetricsSnapshot;
pub use metrics::OperationMetrics;
pub use metrics::SessionMetrics;
pub use operations::AgentTraversal;
pub use operations::BlockView;
pub use operations::ExpandDirection;
pub use operations::ExpandOptions;
pub use operations::ExpansionResult;
pub use operations::FindResult;
pub use operations::NavigationResult;
pub use operations::NeighborhoodView;
pub use operations::SearchOptions;
pub use rag::MockRagProvider;
pub use rag::NullRagProvider;
pub use rag::RagCapabilities;
pub use rag::RagMatch;
pub use rag::RagProvider;
pub use rag::RagSearchOptions;
pub use rag::RagSearchResults;
pub use safety::BudgetTracker;
pub use safety::CircuitBreaker;
pub use safety::CircuitState;
pub use safety::DepthGuard;
pub use safety::GlobalLimits;
pub use safety::OperationBudget;
pub use safety::SessionLimits;
pub use session::AgentCapabilities;
pub use session::AgentSession;
pub use session::SessionConfig;
pub use session::SessionInfo;
pub use session::SessionState;

Modules§

cursor
Traversal cursor for tracking position in the graph.
error
Error types for the agent traversal system.
executor
UCL command executor for agent traversal and context operations.
metrics
Metrics and observability for agent sessions.
operations
Core operations for agent graph traversal.
rag
RAG (Retrieval-Augmented Generation) provider interface.
safety
Safety mechanisms: limits, circuit breakers, and guards.
session
Agent session management.