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-09-03
- Stars
- ★ 351
- Forks
- 27
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 资源文件 4
- 参考文档references/api-contracts.md9.6 KB
- 参考文档references/sdk-reference.md11.7 KB
- 参考文档references/troubleshooting.md9.0 KB
- 脚本scripts/normalize_flow_file.py4.3 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
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).