API Reference¶
Complete reference for FastroAI's public API.
All classes, functions, and protocols documented here are considered stable and follow semantic versioning.
Looking for explanations?
This is a reference, not a tutorial. For explanations and examples, see the Guides.
Core Components¶
-
Agent
FastroAgent, AgentConfig, ChatResponse, StreamChunk
-
Pipelines
Pipeline, BaseStep, StepContext, configurations
-
Tools
@safe_tool decorator, SafeToolset, FunctionToolsetBase
-
Usage
CostCalculator with microcents precision
-
Tracing
Tracer protocol, SimpleTracer, LogfireTracer, NoOpTracer
Quick Import Reference¶
from fastroai import (
# Agent
FastroAgent,
AgentConfig,
ChatResponse,
StreamChunk,
# Pipelines
Pipeline,
PipelineResult,
PipelineConfig,
BaseStep,
StepContext,
StepConfig,
step,
ConversationState,
ConversationStatus,
# Tools
safe_tool,
SafeToolset,
FunctionToolsetBase,
# Tracing
Tracer,
SimpleTracer,
LogfireTracer,
NoOpTracer,
# Usage
CostCalculator,
# Errors
FastroAIError,
PipelineValidationError,
CostBudgetExceededError,
)
Error Hierarchy¶
All FastroAI exceptions inherit from FastroAIError, so you can catch all library errors with a single except clause:
FastroAIError # Base for all FastroAI errors
├── PipelineValidationError # Invalid pipeline configuration
├── StepExecutionError # Step failed during execution
└── CostBudgetExceededError # Cost budget exceeded
try:
result = await pipeline.execute(inputs, deps)
except FastroAIError as e:
logger.error(f"FastroAI error: {e}")