Skip to Content
All exports

API reference

This page lists the import path for every public name in loomflow, grouped by purpose, so you can find where something lives. Each group links to the page that explains how to use it. For full parameter-by-parameter references see Agent, Workflow and the architecture classes.

The package ships a py.typed marker, so IDEs (Pylance, Pyright, mypy) get autocomplete and go-to-definition on every public symbol. If your IDE doesn’t pick this up, see Common pitfall: stale install.

Agent

from loomflow import Agent, Tuning from loomflow import ApprovalDecision, GoalStopHook, StopHook, StopHookResult

The model-driven loop. See What is an Agent and the Agent reference.

Tuning groups the rarely-touched knobs (retry_policy, secrets, auto_consolidate, response_tone, stop_hooks, max_stop_hook_iterations, checkpoint, tool search, memory budget, and the tool-transcript / auto-compact settings) into one optional dataclass: pass Agent(..., tuning=Tuning(...)). See Tuning fields.

ApprovalDecision is the rich return type for approval handlers. GoalStopHook is what Agent(run_until=...) installs; StopHook / StopHookResult let you write your own.

Workflow

from loomflow import END, START, Workflow, WorkflowResult, step

Graphs of steps you define in code. See Workflow and the Workflow reference.

Architectures

from loomflow import Architecture, ReAct from loomflow.architecture import ActorCritic, Blackboard, BlackboardArchitecture, BlackboardEntry, MultiAgentDebate, Plan, PlanAndExecute, PlanStep, Reflexion, ReWOO, ReWOOPlan, ReWOOStep, ReWOOStepResult, Router, RouterRoute, SelfRefine, StepResult, Supervisor, Swarm, Handoff, ThoughtNode, TreeOfThoughts, AgentSession, Dependencies, resolve_architecture from loomflow.team import Team, run_architecture

See Architectures.

Models

from loomflow import EchoModel, ScriptedModel, ScriptedTurn, Image, count_tokens from loomflow.model import AnthropicModel, FallbackModel, LiteLLMModel, OpenAIModel, default_fall_on from loomflow.model.retrying import RetryingModel

See Models · Fallback chains + timeouts · Vision.

Context management

from loomflow import context_window_for, maybe_auto_compact, snip_messages

The helpers behind Agent(snip_window=) and Agent(auto_compact_at_tokens=), exposed for custom architectures. See snip_window and auto_compact_at_tokens.

Memory

from loomflow import HashEmbedder, InMemoryMemory, resolve_memory from loomflow.memory import ChromaFactStore, ConsolidationWorker, Consolidator, FactStore, InMemoryFactStore, PostgresFactStore, RedisFactStore, SqliteFactStore from loomflow.memory.auto_extract import AutoExtractMemory from loomflow.memory.chroma import ChromaMemory from loomflow.memory.embedder import CohereEmbedder, OpenAIEmbedder, VoyageEmbedder from loomflow.memory.lazy import LazyMemory from loomflow.memory.postgres import PostgresMemory from loomflow.memory.redis import RedisMemory from loomflow.memory.sqlite import SqliteMemory from loomflow.memory.vector import VectorMemory

See Memory.

Vector stores and loaders

from loomflow.vectorstore import ChromaVectorStore, FAISSVectorStore, InMemoryVectorStore, PostgresVectorStore, SearchResult, VectorStore from loomflow.loader import Chunk, Document, MarkdownChunker, RecursiveChunker, SentenceChunker, TokenChunker, chunk, load

See RAG · Loaders · Chunkers.

Tools

from loomflow import LivingPlan, LivingPlanStep, Tool, tool, web_tool from loomflow.tools import InProcessToolHost, PathEscapeError, bash_tool, default_workdir, edit_tool, filesystem_tools, find_tool, grep_tool, ls_tool, read_tool, write_tool from loomflow.tools import CodeExecutor, SubprocessExecutor, make_code_mode_tools from loomflow.tools.plan import get_active_plan, make_plan_tools, make_recall_past_plans_tool

See Tools · Built-in tools · Code mode · Living plan.

Workspace

from loomflow import ( InMemoryWorkspace, LocalDiskWorkspace, Workspace, WorkspaceMembership, resolve_workspace, ) from loomflow.workspace import ( Note, NoteKind, NoteMatch, NoteSummary, NoteVersion, PruneResult, make_workspace_tools, workspace_prompt_section, )

See Workspace · Workspace lifecycle.

Skills

from loomflow.skills import Skill, SkillError, SkillMetadata, SkillRegistry, SkillSource

See Skills.

MCP

from loomflow.mcp import MCPClient, MCPRegistry, MCPServerSpec

See MCP.

Runtime

from loomflow import InProcRuntime from loomflow.runtime import Checkpoint, CheckpointMeta, InMemoryJournalStore, JournaledRuntime, JournalStore, PostgresJournalStore, PostgresRuntime, SqliteJournalStore, SqliteRuntime, journal_scope, resolve_runtime

See Runtime · Checkpoints.

Security

from loomflow import AllowAll, AuditLog, FullTranscriptAuditLog, HookRegistry, InMemoryAuditLog, Mode, NoSandbox, OSSandbox, StandardPermissions from loomflow.security import AuditProblem, AuditVerification, DictSecrets, EnvSecrets, FileAuditLog, FilesystemSandbox, PerUserPermissions, SubprocessSandbox, verify_chain, verify_signature

See Security.

Guardrails

from loomflow.guardrails import GuardedStream, Guardrail, GuardrailOutcome, GuardrailTrigger, GuardVerdict, InjectionGuard, ModerationGuard, PIIGuard, RegexGuard, apply_guardrails

Not re-exported from the top-level package. See Guardrails.

Governance

from loomflow import BudgetConfig, NoBudget, StandardBudget, TokenBucketRateLimiter from loomflow.governance import RateLimiter, RetryPolicy, classify_model_error, compute_backoff

See RetryPolicy + error taxonomy · Per-user budget caps · Rate limiting.

Decisions

from loomflow.decisions import Box, Choice, DecisionApprovalPolicy, DecisionGuard, DecisionModel, Decisions, JevModel, LLMDecisionModel, Noul, Question, Score, ScriptedDecisions

Typed answers with probabilities for the framework’s internal judgments (which route, is the goal met, is this call risky) without a full LLM call. See Decisions.

Observability

from loomflow import NoTelemetry from loomflow.observability import ( InMemoryTelemetry, ConsoleTelemetry, FileTelemetry, MultiTelemetry, OTelTelemetry, CapturedSpan, CapturedMetric, ) from loomflow.graph import AgentGraph, build_graph, write_graph

See OpenTelemetry · AgentGraph.

Studio

import loomflow.studio from loomflow.studio import dataset, disable, enable, flush, is_enabled, prune, score, session from loomflow.studio.web import create_app

enable(path, project=, sample_rate=, capture_content=, redact=, keep_days=) records every run; session(project=, tags=, metadata=, enabled=) scopes it; score(result, key, value) attaches a score; prune(days) deletes old runs; dataset(name) loads a dataset built in Studio as an eval Dataset; create_app(path, read_only=, allowed_hosts=, agents=) is the loom studio web app (agents= are the agents its page may run evals on). Environment: LOOMFLOW_STUDIO, LOOMFLOW_STUDIO_PROJECT, LOOMFLOW_STUDIO_KEEP_DAYS. See Studio.

Evals

from loomflow.eval import Case, CaseResult, Dataset, EvalHarness, EvalReport, LLMJudge

See Evals.

Serving and A2A

from loomflow.serve import create_app from loomflow.a2a import A2AClient, AgentCard, serve_a2a

See Serving over HTTP · A2A protocol.

Data lineage

from loomflow.core.types import CertifiedValue from loomflow.data import FreshnessPolicy, LineagePolicy, check_freshness, check_lineage, require_freshness, require_lineage

CertifiedValue wraps a value with its source, fetch time, expiry and lineage. The policies check it and raise FreshnessError / LineageError (see Errors).

Core types

from loomflow import BudgetStatus, Episode, EpisodeMatch, Event, EventKind, Fact, MemoryBlock, MemoryExport, MemoryProfile, Message, PermissionDecision, Role, RunResult, ToolCall, ToolDef, ToolResult, Usage from loomflow.core.types import AuditEntry, ModelChunk, PromptCacheConfig, Span, ToolEvent

PromptCacheConfig is what the Agent(prompt_caching=) kwarg resolves to. Usage carries cached_input_tokens and RunResult carries cached_tokens_in, plus cache_write_tokens on both. See Prompt caching.

Protocols

from loomflow import Budget, Embedder, HookHost, Memory, Model, Permissions, Runtime, Sandbox, Secrets, Telemetry, ToolHost

Implement any of these to add a new backend without forking the framework.

RunContext

from loomflow import IsolationWarning, RunContext, get_run_context, set_run_context

See Run vs Session vs RunContext.

Errors

from loomflow import BudgetExceeded, ConfigError, LoomError, OutputValidationError, RateLimitExceeded, RunTimeout from loomflow.core.errors import AuthenticationError, CancelledByUser, ContentFilterError, FreshnessError, InvalidRequestError, LineageError, MCPError, MemoryStoreError, ModelError, PermanentModelError, PermissionDenied, RateLimitError, RuntimeJournalError, SandboxError, ToolError, TransientModelError from loomflow.model._effort import EffortNotSupportedError from loomflow import LoomDeprecationWarning

See Errors.

Identity helpers

from loomflow import new_id from loomflow.core.ids import deterministic_hash

new_id() returns a fresh ULID. deterministic_hash(obj) returns a stable hash of any JSON-serializable object. The framework uses it for journal keys; it is also useful in custom architectures.

Version

from loomflow import __version__

__version__ is the installed version string. These docs describe loomflow 0.17.

Last updated on