API Reference
This comprehensive API reference covers all the core components, decorators, and utilities available in the Foomstack framework.Core Decorators
@workflow
Callable
The function to be decorated as a workflow
Callable
The decorated workflow function with enhanced execution capabilities
@transformer
Callable
The function to be decorated as a transformer
Callable
The decorated transformer function with caching and tracing
Core Classes
WorkflowResult
bool
Whether the workflow execution was successful
Any
The result data from the workflow execution
Optional[str]
Error message if the workflow failed
float
Total execution time in seconds
List[Dict]
Detailed execution trace for debugging
Provider Classes
OpenAIProvider
str
required
OpenAI API key for authentication
str
default:"gpt-4"
The OpenAI model to use for completions
float
default:"0.7"
Sampling temperature between 0 and 2
OpenAI
Configured OpenAI client instance
AnthropicProvider
str
required
Anthropic API key for authentication
str
default:"claude-3-sonnet-20240229"
The Anthropic model to use for completions
float
default:"0.7"
Sampling temperature between 0 and 1
Anthropic
Configured Anthropic client instance
Utility Functions
cache_result
int
default:"3600"
Time to live in seconds for cached results
Optional[Callable]
default:"None"
Custom function to generate cache keys
parallel_map
Callable
Function to apply to each item
List[Any]
List of items to process
int
default:"4"
Maximum number of concurrent workers
List[Any]
List of results in the same order as input items
Configuration Classes
FoomstackConfig
Dict[str, Provider]
Dictionary of configured providers by name
CacheBackend
Configured caching backend
bool
Whether tracing is enabled
int
Maximum number of retries for failed operations
float
Global timeout for operations in seconds
Error Classes
WorkflowError
str
Human-readable error message
str
Name of the workflow that failed
str
Name of the step that failed
str
Full Python traceback for debugging
ProviderError
str
Human-readable error message
str
Name of the provider that failed
Optional[int]
HTTP status code if applicable
Optional[int]
Seconds to wait before retrying