Skip to main content

Crate traitclaw_core

Crate traitclaw_core 

Source
Expand description

§TraitClaw Core

Core traits, types, and runtime for the TraitClaw AI Agent Framework.

This crate provides the fundamental abstractions for building AI agents:

  • Provider — LLM abstraction trait
  • Tool — Tool definition trait with auto JSON Schema
  • Memory — 3-layer memory system (conversation, working, long-term)
  • Guard — Hard boundary checks for model steering
  • Hint — Contextual guidance injection
  • Tracker — Runtime state monitoring
  • Agent — The main agent struct with builder pattern

§Quick Start

use traitclaw_core::prelude::*;

// Agent creation is done via the builder pattern
// (requires a Provider implementation)

Re-exports§

pub use traits::context_strategy::ContextStrategy;
pub use traits::context_strategy::NoopContextStrategy;
pub use traits::context_strategy::SlidingWindowStrategy;
pub use traits::execution_strategy::AdaptiveStrategy;
pub use traits::execution_strategy::ExecutionStrategy;
pub use traits::execution_strategy::ParallelStrategy;
pub use traits::execution_strategy::PendingToolCall;
pub use traits::execution_strategy::SequentialStrategy;
pub use traits::execution_strategy::ToolResult;
pub use traits::guard::Guard;
pub use traits::guard::GuardResult;
pub use traits::hint::Hint;
pub use traits::hint::HintMessage;
pub use traits::hint::HintPriority;
pub use traits::hint::InjectionPoint;
pub use traits::memory::Memory;
pub use traits::output_processor::ChainProcessor;
pub use traits::output_processor::NoopProcessor;
pub use traits::output_processor::OutputProcessor;
pub use traits::output_processor::TruncateProcessor;
pub use traits::provider::Provider;
pub use retry::RetryConfig;
pub use retry::RetryProvider;
pub use traits::tool::ErasedTool;
pub use traits::tool::Tool;
pub use traits::tool::ToolSchema;
pub use traits::tracker::Tracker;
pub use types::action::Action;
pub use types::agent_state::AgentState;
pub use types::completion::CompletionRequest;
pub use types::completion::CompletionResponse;
pub use types::completion::Usage;
pub use types::message::Message;
pub use types::message::MessageRole;
pub use types::model_info::ModelInfo;
pub use types::model_info::ModelTier;
pub use types::stream::CompletionStream;
pub use types::stream::StreamEvent;
pub use types::tool_call::ToolCall;
pub use error::Error;
pub use error::Result;
pub use memory::in_memory::InMemoryMemory;
pub use agent::Agent;
pub use agent::AgentOutput;
pub use agent::AgentOutputContent;
pub use agent::AgentSession;
pub use agent::RunUsage;
pub use agent_builder::AgentBuilder;

Modules§

agent
Agent — the main entry point for running AI agents.
agent_builder
Agent builder for fluent configuration.
config
Agent configuration.
error
Error types for TraitClaw Core.
memory
Memory implementations.
prelude
Prelude module for convenient imports.
retry
Retry wrapper for LLM providers with exponential backoff.
traits
Core trait definitions for TraitClaw.
types
Shared types for TraitClaw.