sdk-and-api-clients
Integrate with Langflow through REST APIs, OpenAPI contracts, Python SDK clients, streaming runs, and flow/project push-pull workflows.
- License 许可
- MIT
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- sdk-and-api-clients
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Integrate with Langflow through REST APIs, OpenAPI contracts, Python SDK clients, streaming runs, and flow/project push-pull workflows.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/api-contracts.md9.6 KB
- 参考文档references/sdk-reference.md11.7 KB
- 参考文档references/troubleshooting.md9.0 KB
03 SKILL.md 正文
SDK And API Clients
Use this sub-skill when the task is to call a Langflow server from application code, validate API examples, inspect OpenAPI contracts, normalize flow JSON for source control, or debug client-side API failures.
Route elsewhere when the user wants local flow execution with lfx run or lfx serve (../executor-cli/SKILL.md), backend route/service implementation (../backend-runtime/SKILL.md), flow JSON authoring semantics (../flow-authoring/SKILL.md), or deployment and server configuration (../deployment-and-operations/SKILL.md).
Fast Start
- Use
references/sdk-reference.mdfor Python SDK construction, sync/async clients, CRUD, run/stream helpers, push/pull, environment config, and typed exceptions. - Use
references/api-contracts.mdfor REST endpoint shapes, OpenAPI files, streaming event contracts, TypeScript client notes, and API example validation strategy. - Use
references/troubleshooting.mdfor install/import errors, auth and HTTP failures, streaming edge cases, schema problems, normalization surprises, and backend-boundary signals. - Run
scripts/normalize_flow_file.pywhen a flow JSON file must be made deterministic and safe for git before review or push.
Common Workflows
- Construct a Python client: prefer
from langflow_sdk import Client, AsyncClient; passbase_url, optionalapi_key, and optionaltimeout. Use context managers (with Client(...) as client:orasync with AsyncClient(...) as client:) when the client owns its HTTP transport. - Run a flow: call
client.run(flow_id_or_endpoint, input_value="...")for the simple case, orclient.run_flow(flow_id_or_endpoint, RunRequest(...))when settinginput_type,output_type,tweaks, orstreamexplicitly. - Stream a flow: iterate
client.stream(...)orasync for chunk in client.stream(...); handlechunk.is_token,chunk.is_end, andchunk.is_error, and mapLangflowAuthError/LangflowHTTPErrorseparately from event-level failures. - Manage flows and projects: use
list_flows,get_flow,create_flow,update_flow,upsert_flow,delete_flow,list_projects,download_project, andupload_project;push/pullwrap file-based flow upsert and normalized download. - Normalize a flow file: run
python scripts/normalize_flow_file.py flow.json --output flow.normalized.json --code-as-linesto strip secrets and volatile UI/server fields with deterministic JSON output.
Validation Checklist
- Verify the target server URL includes scheme and port, for example
http://localhost:7860, and does not include trailing API path segments. - Verify API keys are passed as
x-api-keythrough SDKapi_keyor explicit HTTP headers; do not embed real keys in examples or committed TOML. - For write operations, validate IDs and payloads with SDK models (
FlowCreate,FlowUpdate,ProjectCreate,RunRequest) before sending. - For streaming clients, assert non-2xx HTTP statuses raise typed SDK exceptions before parsing stream chunks, and assert final
endchunks are optional in error paths. - For OpenAPI or docs examples, prefer offline schema/example linting first; only run live examples against an intentionally started local or test Langflow instance.
References And Helpers
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.