Skip to content

Public API index

The package root is the stable import surface:

from executionkit import Provider, TokenUsage, consensus

Names listed here come from executionkit.__all__. Import internal modules only when a guide explicitly identifies an advanced extension point.

Patterns

Name Purpose Reference
consensus Vote across independent completions. Patterns
refine_loop Generate, score, and revise. Patterns
react_loop Run a bounded model/tool loop. Patterns
structured Parse, validate, and repair JSON. Patterns
pipe Pass one pattern result to the next. Patterns
map_reduce Map across inputs and reduce the results. Patterns
consensus_sync Synchronous wrapper for consensus. Patterns
refine_loop_sync Synchronous wrapper for refine_loop. Patterns
react_loop_sync Synchronous wrapper for react_loop. Patterns
structured_sync Synchronous wrapper for structured. Patterns
pipe_sync Synchronous wrapper for pipe. Patterns
map_reduce_sync Synchronous wrapper for map_reduce. Patterns

Pattern values and protocols

Name Purpose Reference
PatternResult Completed pattern value, score, cost, and metadata. Patterns
StreamingPatternResult Async text stream with a live cost view. Patterns
TokenUsage Input-token, output-token, and call counts. Patterns
Tool Registered async tool definition. Patterns
VotingStrategy majority or unanimous. Patterns
TerminationReason Reason a loop stopped. Patterns
Evaluator Async response-score callback type. Patterns
CheckpointCallback Loop checkpoint callback type. Patterns
PatternStep Callable protocol accepted by pipe. Patterns

Providers and responses

Name Purpose Reference
Provider OpenAI-compatible chat-completions HTTP client. Providers
LLMProvider Structural protocol for non-streaming providers. Providers
ToolCallingProvider Provider protocol with tool-call support. Providers
StreamingProvider Provider protocol with an async text stream. Providers
LLMResponse Parsed provider response. Providers
ToolCall Parsed model-requested tool call. Providers
MockProvider Scripted provider for tests. Providers
ClaudeAgentProvider Claude Agent SDK transport authenticated by a Claude subscription sign-in. Providers

Session and execution controls

Name Purpose Reference
Kit Provider session with cumulative usage and optional conversation state. Execution helpers
RetryConfig Retry count, delay, exception, and rate-limit policy. Execution helpers
DEFAULT_RETRY Default retry configuration. Execution helpers
TokenBucket Async call pacing and cooldown. Execution helpers
CostTracker Mutable token and call accumulator. Execution helpers
estimate_cost Apply caller-supplied token rates. Execution helpers
ConvergenceDetector Score-threshold and stalled-progress detector. Execution helpers
extract_json Extract a JSON object or array from model text. Patterns
validate_score Require a finite score in [0.0, 1.0]. Patterns
checked_complete Advanced budgeted/retried completion helper. Patterns
checked_stream Advanced budgeted/retried streaming helper. Patterns

Routing, workflows, plans, and approval

Name Purpose Reference
RouteRule Named provider-selection predicate. Execution helpers
Router Select a provider and optionally run a pattern. Execution helpers
Step Named workflow step with dependencies. Execution helpers
Workflow Run steps after their dependencies complete. Execution helpers
WorkflowCheckpoint Workflow progress snapshot with to_dict() and from_dict(). Execution helpers
WorkflowResult Workflow outputs and total usage. Execution helpers
PlanStep Named ordered plan step. Execution helpers
Plan Run plan steps in order. Execution helpers
PlanResult Plan outputs and total usage. Execution helpers
ApprovalRequest Proposed action sent to an approval callback. Execution helpers
ApprovalDecision Approval result and reason. Execution helpers
ApprovalGate Sync-or-async approval callback with timeout policy. Execution helpers

Tracing

Name Purpose Reference
TraceEvent Event kind and read-only payload. Execution helpers
TraceCallback Sync-or-async event callback type. Execution helpers
emit_trace Invoke a trace callback when present. Execution helpers
CallRecord One logical LLM call reconstructed from correlated trace events. Execution helpers
TraceCollector Trace callback building per-call records and portable run summaries. Execution helpers

Evaluation

Name Purpose Reference
EvalCase One run/check pair. Evaluation
EvalResult One case result. Evaluation
EvalReport Aggregate results and accuracy. Evaluation
run_eval_suite Run cases in order. Evaluation
Turn One checked conversation turn. Evaluation
ConversationScript Ordered conversation turns. Evaluation
run_conversation_script Evaluate a script with one Kit. Evaluation
live_provider_from_env Build an opt-in live provider from environment variables. Evaluation

Anthropic Message Batches

Name Purpose Reference
AnthropicBatchClient Minimal native Message Batches HTTP client. Batch API
consensus_batch Run consensus samples as one batch job. Batch API
map_batch Submit several prompts and return ordered responses. Batch API

Exceptions

Name Meaning Reference
ExecutionKitError Base package exception. Execution helpers
LLMError Base provider-call exception. Execution helpers
RateLimitError HTTP 429 with retry_after. Execution helpers
PermanentError Non-retryable provider error. Execution helpers
ProviderError Retryable transport or provider error. Execution helpers
PatternError Base pattern exception. Execution helpers
BudgetExhaustedError A token or call budget blocked another attempt. Execution helpers
ConsensusFailedError Unanimous consensus was not reached. Execution helpers
MaxIterationsError A bounded loop ended without a final answer. Execution helpers
ApprovalDeniedError A required approval was denied. Execution helpers
ApprovalTimeoutError An approval timed out under the raise policy. Execution helpers

Package information

__version__ is the installed package version.