Skip to content

API reference

The full public API exported from langstitch. Import anything from the top level:

from langstitch import (
    graph_node, graph, skill,
    input_guardrail, output_guardrail,
    business_policy, persona, configuration,
    langstitch_graph_server, GraphBuilder, LangStitchApp,
    load_config, get_registry, START, END,
)

Decorators

Symbol Kind Purpose
@graph_node decorator node handler state → dict
@graph decorator graph builder (entrypoint=, parent=)
@skill decorator reusable capability
@input_guardrail / @output_guardrail decorator inbound/outbound validation
@business_policy decorator priority-ordered org rule
@persona decorator identity / system prompt
@configuration decorator bind a config section to a dataclass
@tool / @worker_agent decorator LLM tool / delegatable sub-agent
@langstitch_graph_server decorator graph API server (protocol, port, name, properties)

MCP

Symbol Kind Purpose
@langstitch_mcp_server decorator MCP server class + transport
@mcp_tool decorator expose a callable as an MCP tool
@mcp_resource decorator expose a readable MCP resource
@mcp_prompt decorator expose a reusable MCP prompt

Graph

Symbol Kind Purpose
GraphBuilder class declarative wiring → LangGraph
START, END const edge sentinels

Runtime

Symbol Kind Purpose
LangStitchApp class runtime: bootstrap(), build_graph(), invoke(), info()
create_app fn build the FastAPI app (needs server)
run fn start the server

Providers & helpers

Symbol Kind Purpose
get_config, reset_config_cache fn cached config access
get_env, get_secret fn environment & secret access
get_logger fn configured logger
get_llm_provider fn chat model from model: config
get_http_client, get_async_http_client fn configured httpx clients

External services

Symbol Kind Purpose
AuthConfig, ServiceConfig dataclass service definitions
ServiceClient, AsyncServiceClient class typed HTTP clients
load_service_config, format_path fn service helpers
set_request_headers, get_request_headers, clear_request_headers fn header propagation

Config

Symbol Kind Purpose
AppConfig class parsed configuration object
load_config, load_application_config, load_env fn load config & env
find_project_root fn locate the project root
query_json fn JSON-path lookups
compile_config fn YAML → JSON precompile

Registry

Symbol Kind Purpose
Registry, get_registry, reset_registry class/fn the process-global registry

Dynamic registries

Symbol Kind Purpose
ToolRegistry, AgentRegistry class lazy spec registries
get_tool_registry, get_agent_registry fn registry accessors
get_all_tools, get_all_worker_agents fn list specs
get_input_guardrails, get_output_guardrails fn list guardrail specs
get_skills, get_policies, get_personas fn list specs
refresh_registries fn force a refresh

Hierarchical context

Symbol Kind Purpose
Context, ContextScope, ContextBuilder class context primitives
LLMContext class the object a model callback receives
run_llm, run_worker_agent fn run an isolated LLM / sub-agent call

Source of truth

Exhaustive signatures and options ship with the langstitch-sdk package on PyPI — inspect them via python -c "help('langstitch')" after install.