| Crates.io | abk |
| lib.rs | abk |
| version | 0.2.4 |
| created_at | 2025-11-01 07:38:00.841839+00 |
| updated_at | 2025-12-31 15:36:03.239722+00 |
| description | Agent Builder Kit - Complete modular agent building blocks with feature-gated modules |
| homepage | https://abk.podtan.com |
| repository | https://github.com/podtan/abk |
| max_upload_size | |
| id | 1911793 |
| size | 1,185,629 |
Modular utilities for building LLM agents
ABK is a feature-gated Rust crate providing essential utilities for building LLM-based agents. Choose only the components you need via Cargo features.
Complete modular agent building blocks with feature-gated modules
ABK is a comprehensive Rust crate providing feature-gated modules for building LLM-based agents. Choose only the components you need via Cargo features to keep your builds lean and focused.
ABK provides feature-gated modules organized by functionality:
config - TOML configuration loading and environment variable resolutionobservability - Structured logging with file/console outputcheckpoint - Session persistence and resume capabilitiesexecutor - Command execution with timeout and validationorchestration - Workflow coordination and session managementlifecycle - WASM lifecycle plugin integrationcli - Command-line interface utilities and formatting with convenience functionsprovider - LLM provider abstraction with WASM supportagent - Complete agent implementation with all dependenciesall - Enables all features for complete functionalityAdd to your Cargo.toml:
[dependencies]
# Enable only the features you need:
abk = { version = "0.1.24", features = ["config"] }
# Or enable multiple features:
abk = { version = "0.1.24", features = ["config", "observability", "executor"] }
# Or enable everything:
abk = { version = "0.1.24", features = ["all"] }
use abk::config::{ConfigurationLoader, EnvironmentLoader};
use std::path::Path;
// Load environment variables
let env = EnvironmentLoader::new(None);
// Load configuration from TOML
let config_loader = ConfigurationLoader::new(
Some(Path::new("config/simpaticoder.toml"))
).unwrap();
let config = &config_loader.config;
// Access configuration
println!("Max iterations: {}", config.execution.max_iterations);
println!("LLM provider: {:?}", env.llm_provider());
use abk::observability::Logger;
use std::collections::HashMap;
// Create a logger with custom path and log level
let logger = Logger::new(
Some(Path::new("logs/agent.md")),
Some("DEBUG")
).unwrap();
// Log session lifecycle
let config = HashMap::new();
logger.log_session_start("auto", &config).unwrap();
// Log LLM interactions
let messages = vec![];
logger.log_llm_interaction(&messages, "Response text", "gpt-4").unwrap();
// Log completion
logger.log_completion("Task completed successfully").unwrap();
use abk::cli::{run_configured_cli_from_config, CommandContext};
// Option 1: One-liner convenience function (recommended for simple apps)
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
run_configured_cli_from_config("config/agent.toml").await
}
// Option 2: Full customization with CommandContext trait
struct MyContext { /* custom implementation */ }
impl CommandContext for MyContext { /* implement all methods */ }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let context = MyContext::new();
let cli_config = CliConfig::from_simpaticoder_config(&context.config);
run_configured_cli(&context, &cli_config).await
}
use abk::checkpoint::{get_storage_manager, CheckpointResult};
// Initialize checkpoint storage
let manager = get_storage_manager()?;
let project_path = Path::new(".");
let project_storage = manager.get_project_storage(project_path).await?;
// Create a new session
let session_storage = project_storage.create_session("my-task").await?;
use abk::provider::ProviderFactory;
// Create LLM provider from environment
let provider = ProviderFactory::create(&env)?;
// Generate text
let config = GenerateConfig {
max_tokens: 100,
temperature: 0.7,
..Default::default()
};
let response = provider.generate(&messages, &config).await?;
use abk::agent::Agent;
// Create a complete agent
let mut agent = Agent::new(
Some(Path::new("config.toml")),
Some(Path::new(".env")),
Some(AgentMode::Confirm)
)?;
// Agent has access to all features:
// - Configuration via agent.config
// - Executor via agent.executor
// - Logger via agent.logger
// - Provider via agent.provider
// - Checkpoint manager via agent.session_manager
ABK has evolved from a simple configuration utility to a comprehensive Agent Builder Kit:
config feature (v0.1.0 - configuration management)observability feature (v0.1.1 - logging and metrics)checkpoint feature (v0.1.2 - session persistence)provider feature (v0.1.3+ - LLM provider abstraction)executor feature (v0.1.23 - command execution)orchestration feature (v0.1.23 - workflow management)lifecycle feature (v0.1.23 - WASM plugin integration)cli feature (v0.1.23 - command-line utilities)agent feature (v0.1.23 - complete agent implementation)ABK provides a unified, modular foundation for building LLM agents:
Instead of maintaining separate crates for each component, ABK unifies them under one package with feature flags:
Dual-licensed under MIT OR Apache-2.0