Skip to main content

Dan's Simple Agent Toolkit - Multi-provider LLM agents and experiment tracking

Project description

Dan's Simple Agent Toolkit (DSAT)

DSAT is a comprehensive Python toolkit for building LLM applications and running experiments. It provides three core components that work independently or together:

๐Ÿ’ฌ Chat CLI

An interactive terminal-based chat interface for testing prompts and having conversations with LLM agents.

Key Features:

  • Zero-config mode: Auto-detects providers via environment variables
  • Real-time streaming: Token-by-token streaming support for all providers
  • Multiple usage patterns: Config files, inline creation, or auto-discovery
  • Interactive commands: /help, /agents, /switch, /stream, /memory, /compact, and more
  • Memory management: Configurable conversation limits, auto-compaction, and persistent storage
  • Flexible prompts: Multiple directory search strategies and per-agent overrides
  • Plugin system: Entry points for custom LLM provider extensions
  • Session management: History tracking and conversation export

Quick Start:

# Zero-config (with API key in environment)
dsat chat

# Enable real-time streaming
dsat chat --stream

# Use existing agent configuration
dsat chat --config agents.json --agent my_assistant

# Create agent inline
dsat chat --provider anthropic --model claude-3-5-haiku-latest

๐Ÿค– Agents Framework

A unified interface for working with multiple LLM providers through configuration-driven agents.

Key Features:

  • Multi-provider support: Anthropic Claude, Google Vertex AI, Ollama (local models)
  • Async streaming support: Real-time token streaming with invoke_async() method
  • Configuration-driven: JSON configs + TOML prompt templates
  • Comprehensive logging: Standard Python logging, JSONL files, or custom callbacks
  • Prompt versioning: Versioned prompt management with TOML templates
  • Factory patterns: Easy agent creation and management

Quick Example:

from agents.agent import Agent, AgentConfig

config = AgentConfig(
    agent_name="my_assistant",
    model_provider="anthropic",  # or "google", "ollama"
    model_family="claude", 
    model_version="claude-3-5-haiku-latest",
    prompt="assistant:v1",
    provider_auth={"api_key": "your-api-key"},
    stream=True,  # Enable streaming support
    memory_enabled=True,  # Enable conversation memory
    max_memory_tokens=8000  # Configure memory limit
)

agent = Agent.create(config)

# Traditional response
response = agent.invoke("Hello, how are you?")

# Streaming response
async for chunk in agent.invoke_async("Tell me a story"):
    print(chunk, end='', flush=True)

๐Ÿ“Š Scryptorum Framework

A modern, annotation-driven framework for running and tracking LLM experiments.

Key Features:

  • Dual run types: Trial runs (logs only) vs Milestone runs (full versioning)
  • Annotation-driven: @experiment, @metric, @timer, @llm_call decorators
  • CLI-configurable: Same code runs as trial or milestone based on CLI flags
  • Thread-safe logging: JSONL format for metrics, timings, and LLM calls
  • Project integration: Seamlessly integrates with existing Python projects

Quick Example:

from scryptorum import experiment, metric, timer

@experiment(name="sentiment_analysis")
def main():
    reviews = load_reviews()
    results = []
    
    for review in reviews:
        sentiment = analyze_sentiment(review)
        results.append(sentiment)
    
    accuracy = calculate_accuracy(results)
    return accuracy

@timer("data_loading")
def load_reviews():
    return ["Great product!", "Terrible service", "Love it!"]

@metric(name="accuracy", metric_type="accuracy")
def calculate_accuracy(results):
    return 0.85

๐Ÿ”ง Framework Integration

When used together, DSAT provides AgentExperiment and AgentRun classes that extend Scryptorum's base classes with agent-specific capabilities:

from agents.agent_experiment import AgentExperiment
from scryptorum import metric

@experiment(name="agent_evaluation")
def evaluate_agents():
    # Load agents from configs
    agent1 = Agent.create(config1)
    agent2 = Agent.create(config2)
    
    # Run evaluation with automatic LLM call logging
    score1 = evaluate_agent(agent1)
    score2 = evaluate_agent(agent2) 
    
    return {"agent1": score1, "agent2": score2}

๐Ÿš€ Quick Start

Installation

# Basic installation
git clone <repository-url>
cd dsat
uv sync

# With optional dependencies
uv sync --extra dev      # Development tools
uv sync --extra server   # HTTP server support

Initialize a Project

# Initialize scryptorum in your Python project
scryptorum init

# Create your first experiment
scryptorum create-experiment my_experiment

Run Examples

# Interactive chat interface
dsat chat --config examples/config/agents.json --agent pirate

# Agent conversation demo
python examples/agents/conversation.py

# Agent logging examples  
python examples/agents/agent_logging_examples.py

# Complete experiment with agent evaluation
python examples/scryptorum/literary_evaluation.py

๐Ÿ“ Examples

The examples/ directory contains comprehensive demonstrations:

๐Ÿ—๏ธ Architecture

your_project/                    โ† Your Python Package
โ”œโ”€โ”€ src/your_package/
โ”‚   โ”œโ”€โ”€ experiments/             โ† Your experiment code
โ”‚   โ””โ”€โ”€ agents/                  โ† Your agent code  
โ”œโ”€โ”€ .scryptorum                  โ† Scryptorum config
โ””โ”€โ”€ pyproject.toml              โ† Dependencies

~/experiments/                   โ† Scryptorum Project (separate location)
โ”œโ”€โ”€ your_package/               โ† Project tracking
โ”‚   โ”œโ”€โ”€ experiments/            โ† Experiment data & results
โ”‚   โ”‚   โ””โ”€โ”€ my_experiment/
โ”‚   โ”‚       โ”œโ”€โ”€ runs/           โ† Trial & milestone runs
โ”‚   โ”‚       โ”œโ”€โ”€ config/         โ† Agent configs
โ”‚   โ”‚       โ””โ”€โ”€ prompts/        โ† Prompt templates
โ”‚   โ””โ”€โ”€ data/                   โ† Shared data

๐Ÿ“– Documentation

๐Ÿ› ๏ธ Development

# Install development dependencies
uv sync --extra dev

# Run tests
python -m pytest test/ -v

# Format code
black src/

# Lint code  
ruff check src/

๐Ÿ“„ License

MIT License - see LICENSE file for details.


DSAT simplifies LLM application development by providing unified agent abstractions and comprehensive experiment tracking with minimal boilerplate.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dsat_ai-0.3.4.tar.gz (254.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dsat_ai-0.3.4-py3-none-any.whl (79.5 kB view details)

Uploaded Python 3

File details

Details for the file dsat_ai-0.3.4.tar.gz.

File metadata

  • Download URL: dsat_ai-0.3.4.tar.gz
  • Upload date:
  • Size: 254.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dsat_ai-0.3.4.tar.gz
Algorithm Hash digest
SHA256 f5ec2262208d592e6bdf0d20d0f8b30e425354b2443cc2a36e1eca0be138da5a
MD5 841ee0a8c2377b34f587fb18d1052240
BLAKE2b-256 72c5c9bb3cf7a5a7fd1cacd1ac0125107dcf011188fb5ac3c17d8fc47a02e9f6

See more details on using hashes here.

File details

Details for the file dsat_ai-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: dsat_ai-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 79.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dsat_ai-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1221b6e9dde273334c1302ba4cac74f64a067da1a5688bdffb0781a593c2d427
MD5 4e4eb2317e3a84dec3c38904c69a9829
BLAKE2b-256 f3e69f61cf01ed80b3eeaff080a2fa06d48552c012357dd5856bc222ca16fc4a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page