AGENT SKILL

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

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

  1. Use references/sdk-reference.md for Python SDK construction, sync/async clients, CRUD, run/stream helpers, push/pull, environment config, and typed exceptions.
  2. Use references/api-contracts.md for REST endpoint shapes, OpenAPI files, streaming event contracts, TypeScript client notes, and API example validation strategy.
  3. Use references/troubleshooting.md for install/import errors, auth and HTTP failures, streaming edge cases, schema problems, normalization surprises, and backend-boundary signals.
  4. Run scripts/normalize_flow_file.py when 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; pass base_url, optional api_key, and optional timeout. Use context managers (with Client(...) as client: or async 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, or client.run_flow(flow_id_or_endpoint, RunRequest(...)) when setting input_type, output_type, tweaks, or stream explicitly.
  • Stream a flow: iterate client.stream(...) or async for chunk in client.stream(...); handle chunk.is_token, chunk.is_end, and chunk.is_error, and map LangflowAuthError/LangflowHTTPError separately 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, and upload_project; push/pull wrap 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-lines to 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-key through SDK api_key or 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 end chunks 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

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351