From d43bf3f588195f507a729fd35cf2570b1869cdef Mon Sep 17 00:00:00 2001 From: Mendon Kissling <59585235+mendonk@users.noreply.github.com> Date: Fri, 6 Mar 2026 09:41:10 -0500 Subject: [PATCH] Docs: 1.8 release (#11295) * langflow-webhook-auth-enable * add-not-contains-filter-operator * does-not-contains-operator * less-redundant-explanation * docs: add jq and path selection to data operations (#10083) add-jq-and-path-to-data-operations * smart transform historical names * change back to smart transform * jq expression capitalization/package name * small edit for clarity of not contains operator * read/write file component name changes * docs: add smart router component (#10097) * init * add-to-release-notes * remove-dynamic-output-as-parameter * Apply suggestion from @aimurphy Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * Apply suggestion from @aimurphy Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * Apply suggestion from @aimurphy Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * Apply suggestion from @aimurphy Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: screenshot audit (#10166) * remove-unused * agent-examples * main-ui-screenshots * components-screenshots * combine-web-search-components * simple-agent-flow-in-playground * round-screenshots * my-projects * combine-data-components * docs: component paths updates for lfx (#10130) * contributing-bundles-path * api-monitor-example * concepts-components-page * contribute-components-path * Apply suggestion from @aimurphy Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: auto-add projects as MCP servers (#10096) * add-mcp-auto-auth-as-default-behavior * Apply suggestion from @aimurphy Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * Apply suggestion from @aimurphy Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> Co-authored-by: Edwin Jose * docs: amazon bedrock converse (#10289) * use-bedrock-converse * Apply suggestion from @aimurphy Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * Update docs/docs/Components/bundles-amazon.mdx --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs 1.7 release: add mock data component (#10288) * add-component-and-release-note * Apply suggestion from @aimurphy Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: update custom component docs (#10323) * add-partial * update-lfx-component-paths * move-partial * completed-quickstart * clean up intro * try-docker-with-custom-mount * up-to-typed-annotations * typed-annotations * dynamic-fields * end-of-file * bundles-naming * chore: update component index --------- Co-authored-by: github-actions[bot] * docs: add cometapi back for 1.7 release (#10445) * add-comet-bundle-back-for-1.7 * add-comet-to-release-notes * docs: add back docling remote vlm for release 1.7 (#10489) * add-back-docling-vlm-content * add-release-note * docs: ALTK component (#10511) * broken-anchor * sidebar-and-page * add-release-note * add-context-on-output * docs: SSRF warning (#10573) * add-ssrf-protection-env-var * api-request-component * Update docs/docs/Components/components-data.mdx * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * move-note-to-table * release-note --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: dynamic create data component (#10517) * add-dynamic-create-data-component-and-release-note * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * clarify-message-types --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: cuga component bundle (#10589) * initlal-content * cuga-specific-component-connections * cleanup * use-the-same-name * add-lite-mode-remove-api-flag-and-mode * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * public-or-private-internet * agent-doesnt-check-urls * peer-review --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: remove docling vlm component from 1.7 release branch (#10630) remove-vlm-component * docs: rename component categories and make all components single pages (#10648) * docs: OpenAPI spec version upgraded from 1.6.5 to 1.6.8 (#10627) Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com> Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com> * up to models and agents * sidebars * fix-broken-links * chore: Fix indentation on bundles-docling.mdx (#10640) * sidebars * redo-intros * link-to-models * data-components * files-components-no-kb * io-components * helper-utility-components * llm-ops-components * logic-components * processing-pages * sidebars * combine-legacy-components-into-one-page * update-links * remove-overview-pages-and-redirect * make-mcp-tools-page * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * no-cap --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com> Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: combined web search component (#10664) * combine-pages * remove-rss-and-news-search-and-update-links * remove-vlm-link * leave-old-release-note-but-remove-link * docs: add altk reflection component (#10660) * add-new-component * differentiate-components * docs: mcp streamable http client (#10621) * release note * mcp-client-changes * update-astra-example * icons-and-copy * order-of-names * docs: add cuga decomposition strategy as advanced parameter (#10672) * update-component-link * init * add-decomp-as-advanced-param * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * update-component-index * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: datastax bundles page (#10686) * init * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: llm router changed to llm selector (#10663) * update-component-name * previous-name-and-release-note * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * docs: log alembic to stdout (#10711) * docs-alembic-log-env-var * cleanup * remove-legacy-component-link * docs: configure s3 for file storage backend (#10678) * configure-file-storage-s3 * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * clarify-s3-credentials * add-storage-tags-and-cleanup-creds-seciton * role-link-name * fix-parse-error --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: allow rest tweaks to mcp tools component (#10833) * typo * tweak-mcp-tools-component * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * add-release-note * docs: use mustache templates in prompts (#11262) * mustache-templating * syntax * release-note * peer-review * docs: smart transform supports Message type (#11306) * component-supports-message-type * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * peer-review --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: modular dependency imports for langflow-base (#11250) * modular-base-dependencies * syntax-and-clarification * release-note * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * [autofix.ci] apply automated fixes * clarify-base-and-langflow * component-index * delete-component-index * [autofix.ci] apply automated fixes * set-agentic-experience * potential-breaking-changes * not-audio-package * cleanup-and-syntax * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * docs: symmetric and asymmetric JWT (#11159) * initial-content * cleanup * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * [autofix.ci] apply automated fixes * docs-peer-review * [autofix.ci] apply automated fixes --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * docs: add markdown output to url component (#11336) * add-markdown-output-format * raw-content * Apply suggestions from code review * docs: Add global variable support for MCP server headers (#11397) * add-global-var-in-mcp-headers * revert-curl-syntax-change * remove-duplicate-tab * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * remove-code-block * add-release-note --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * Update docs/docs/Develop/install-custom-dependencies.mdx * Update docs/docs/Develop/jwt-authentication.mdx * docs: global model provider feature (#11231) * initial-changes-to-model-providers * add-icon-for-model-partial * syntax * adding-custom-language-model * release-note * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * peer-review * use-anthropic-model-with-agent * [autofix.ci] apply automated fixes * design-changes --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * mustache-limitations * release-note-for-jwt * docs: playground refactor and screenshots (#11639) * screenshots * new-playground-and-icon * release-note * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: component inspection panel (#11675) * docs-component-inspection-panel * cleanup * docs: add tool shortlisting and remove web_apps from CUGA component (#11669) docs-add-shortlist-tools-and-remove-webapps-parameters * fix-details-tab-error * docs: workflow API draft build (#11323) * delete-unused-yaml-file * initial-content * add-python-and-ts-to-example-requests * separate-pages * test-spec-presentation * hide-async-and-make-workflows-plural * fix-broken-link * add-changes-to-async * use-workflow-spec-from-sdk-build * make-setup-partial * add-fetch-script-for-openapi-spec * update-workflows-spec * remove-stream-for-now * remove-reconnect-to-stream * consolidate-pages * remove-force-boolean * [autofix.ci] apply automated fixes * docs: add guardrails component (#11674) * docs-add-guardrails-component * cleanup * example-and-heuristic-check * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * [autofix.ci] apply automated fixes * add-note-about-llm * add-release-note --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * docs: pass env var to run command and endpoint as header (#11447) * pass-env-var-to-lfx * add-env-var-passing-to-run-endpoint * add-python-and-js-commands * docs: responses api token usage tracking (#11564) * initlal-content * add-release-note * changes-for-accessing-advanced-parameters * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * small-playground-changes * [autofix.ci] apply automated fixes * Revert "docs: OpenAPI spec content updated without version change (#11787)" This reverts commit a0d5618ac93b13ee88023713ade6e15a5eaa7980. * [autofix.ci] apply automated fixes * docs: add LiteLLM proxy bundle (#11867) * docs-add-litellm-proxy-component * Update docs/docs/Components/bundles-lite-llm.mdx * docs: 1.8 changes from QA (#11998) * remove-rightside-playground * tutorials * image-size-update * component-release-notes * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: pass API keys to args and not env (#11997) * remove-rightside-playground * tutorials * image-size-update * docs-troubleshoot-mcp-proxy-header-keys * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: knowledge bases (#11924) * docs-add-back-kb-content * update-with-release-candidate-branch * fix-linking-error * remove-advanced-flag * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * add-release-note --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: traces v0 (#12014) * env-var-release-note-and-sidebars * traces-and-database * traces-ui-and-api-retrieval * cleanup * space * move-section * move-what-traces-capture-section * docs: remove kb ingestion and rename kb retrieval (#12065) remove-knowledge-ingestion-and-rename-knowledge-retrieval * docs: add link to secret key rotation script (#12072) * add-link-to-secret-key-rotation * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: openlayer follow-on (#12073) * add-openlayer-to-sidebars-and-release-notes * Update docs/docs/Support/release-notes.mdx --------- Co-authored-by: April M <36110273+aimurphy@users.noreply.github.com> Co-authored-by: Edwin Jose Co-authored-by: github-actions[bot] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- docs/docs/API-Reference/api-flows-run.mdx | 333 +- docs/docs/API-Reference/api-monitor.mdx | 119 + .../API-Reference/api-openai-responses.mdx | 124 +- docs/docs/API-Reference/workflows-api.mdx | 528 ++ docs/docs/Agents/agents-tools.mdx | 2 +- docs/docs/Agents/agents.mdx | 45 +- docs/docs/Agents/mcp-client.mdx | 187 +- docs/docs/Agents/mcp-component-astra.mdx | 2 +- docs/docs/Agents/mcp-server.mdx | 34 +- docs/docs/Components/batch-run.mdx | 2 +- docs/docs/Components/bundles-agentics.mdx | 8 +- docs/docs/Components/bundles-composio.mdx | 2 +- docs/docs/Components/bundles-cuga.mdx | 4 +- docs/docs/Components/bundles-datastax.mdx | 2 +- docs/docs/Components/bundles-lite-llm.mdx | 39 + docs/docs/Components/bundles-ollama.mdx | 4 +- docs/docs/Components/components-bundles.mdx | 2 +- .../components-embedding-models.mdx | 25 +- docs/docs/Components/components-models.mdx | 32 +- docs/docs/Components/components-prompts.mdx | 44 +- docs/docs/Components/concepts-components.mdx | 15 +- docs/docs/Components/guardrails.mdx | 64 + docs/docs/Components/if-else.mdx | 2 +- docs/docs/Components/knowledge-base.mdx | 46 + docs/docs/Components/message-history.mdx | 18 +- docs/docs/Components/read-file.mdx | 2 +- docs/docs/Components/smart-transform.mdx | 13 +- docs/docs/Components/url.mdx | 7 +- .../Develop/api-keys-and-authentication.mdx | 13 +- .../Develop/install-custom-dependencies.mdx | 62 +- docs/docs/Develop/jwt-authentication.mdx | 331 + docs/docs/Develop/knowledge.mdx | 131 + docs/docs/Develop/logging.mdx | 1 + docs/docs/Develop/memory.mdx | 2 + docs/docs/Develop/traces.mdx | 55 + docs/docs/Flows/concepts-overview.mdx | 3 +- docs/docs/Flows/concepts-playground.mdx | 13 +- docs/docs/Flows/webhook.mdx | 2 +- .../Get-Started/get-started-quickstart.mdx | 34 +- docs/docs/Support/release-notes.mdx | 108 + docs/docs/Support/troubleshooting.mdx | 30 + docs/docs/_partial-api-setup.mdx | 57 + docs/docs/_partial-escape-curly-braces.mdx | 5 +- docs/docs/_partial-global-model-providers.mdx | 17 + docs/docs/_partial-hidden-params.mdx | 4 +- docs/docs/_partial-kb-summary.mdx | 17 + docs/docusaurus.config.js | 5 + docs/openapi/fetch_openapi_spec.py | 57 + docs/openapi/langflow-workflows-openapi.json | 621 ++ docs/openapi/openapi.json | 6557 +++---------- docs/openapi/openapi.yaml | 8420 ----------------- docs/sidebars.js | 25 +- docs/static/img/agent-component.png | Bin 760842 -> 631345 bytes docs/static/img/agent-example-add-chat.png | Bin 378894 -> 816855 bytes docs/static/img/agent-example-add-tools.png | Bin 463338 -> 1142573 bytes .../img/agent-example-agent-as-tool.png | Bin 565621 -> 1118623 bytes .../img/agent-example-run-flow-as-tool.png | Bin 506041 -> 1510893 bytes .../img/component-astra-db-json-tool.png | Bin 494982 -> 0 bytes docs/static/img/component-chat-io.png | Bin 486839 -> 685684 bytes docs/static/img/component-language-model.png | Bin 329397 -> 855159 bytes docs/static/img/connect-component.png | Bin 479052 -> 855159 bytes .../img/connect-data-components-to-agent.png | Bin 957490 -> 0 bytes .../img/langflow-icon-black-transparent.svg | 5 - .../img/langflow-logo-color-black-solid.svg | 21 - .../img/langflow-logo-color-blue-bg.svg | 21 - docs/static/img/playground-with-agent.png | Bin 412838 -> 275095 bytes docs/static/img/playground.png | Bin 764976 -> 550787 bytes .../prompt-component-with-multiple-inputs.png | Bin 589386 -> 563753 bytes docs/static/img/prompt-component.png | Bin 589386 -> 563753 bytes .../img/quickstart-simple-agent-flow.png | Bin 1057216 -> 993349 bytes .../quickstart-simple-agent-playground.png | Bin 149974 -> 317071 bytes docs/static/img/select-output.png | Bin 32658 -> 715767 bytes docs/static/img/vllm-logo-only-light.ico | Bin 16958 -> 0 bytes docs/static/img/vllm-model-component.png | Bin 1551 -> 0 bytes docs/static/img/workspace-basic-prompting.png | Bin 1060225 -> 995239 bytes docs/static/img/workspace.png | Bin 710080 -> 763047 bytes src/lfx/README.md | 4 + 77 files changed, 4647 insertions(+), 13679 deletions(-) create mode 100644 docs/docs/API-Reference/workflows-api.mdx create mode 100644 docs/docs/Components/bundles-lite-llm.mdx create mode 100644 docs/docs/Components/guardrails.mdx create mode 100644 docs/docs/Components/knowledge-base.mdx create mode 100644 docs/docs/Develop/jwt-authentication.mdx create mode 100644 docs/docs/Develop/knowledge.mdx create mode 100644 docs/docs/Develop/traces.mdx create mode 100644 docs/docs/_partial-api-setup.mdx create mode 100644 docs/docs/_partial-global-model-providers.mdx create mode 100644 docs/docs/_partial-kb-summary.mdx create mode 100755 docs/openapi/fetch_openapi_spec.py create mode 100644 docs/openapi/langflow-workflows-openapi.json delete mode 100644 docs/openapi/openapi.yaml delete mode 100644 docs/static/img/component-astra-db-json-tool.png delete mode 100644 docs/static/img/connect-data-components-to-agent.png delete mode 100644 docs/static/img/langflow-icon-black-transparent.svg delete mode 100644 docs/static/img/langflow-logo-color-black-solid.svg delete mode 100644 docs/static/img/langflow-logo-color-blue-bg.svg delete mode 100644 docs/static/img/vllm-logo-only-light.ico delete mode 100644 docs/static/img/vllm-model-component.png diff --git a/docs/docs/API-Reference/api-flows-run.mdx b/docs/docs/API-Reference/api-flows-run.mdx index fbc78631b..0a421be0a 100644 --- a/docs/docs/API-Reference/api-flows-run.mdx +++ b/docs/docs/API-Reference/api-flows-run.mdx @@ -3,6 +3,9 @@ title: Flow trigger endpoints slug: /api-flows-run --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + Use the `/run` and `/webhook` endpoints to run flows. To create, read, update, and delete flows, see [Flow management endpoints](/api-flows). @@ -20,6 +23,67 @@ Flow IDs can be found on the code snippets on the [**API access** pane](/concept The following example runs the **Basic Prompting** template flow with flow parameters passed in the request body. This flow requires a chat input string (`input_value`), and uses default values for all other parameters. + + + +```python +import requests + +url = "http://LANGFLOW_SERVER_URL/api/v1/run/FLOW_ID" + +# Request payload +payload = { + "input_value": "Tell me about something interesting!", + "session_id": "chat-123", + "input_type": "chat", + "output_type": "chat", + "output_component": "" +} + +# Request headers +headers = { + "Content-Type": "application/json", + "x-api-key": "LANGFLOW_API_KEY" +} + +try: + response = requests.post(url, json=payload, headers=headers) + response.raise_for_status() + print(response.json()) +except requests.exceptions.RequestException as e: + print(f"Error making API request: {e}") +``` + + + + +```js +const payload = { + input_value: "Tell me about something interesting!", + session_id: "chat-123", + input_type: "chat", + output_type: "chat", + output_component: "" +}; + +const options = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'x-api-key': 'LANGFLOW_API_KEY' + }, + body: JSON.stringify(payload) +}; + +fetch('http://LANGFLOW_SERVER_URL/api/v1/run/FLOW_ID', options) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(err => console.error(err)); +``` + + + + ```bash curl -X POST \ "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID" \ @@ -30,11 +94,13 @@ curl -X POST \ "session_id": "chat-123", "input_type": "chat", "output_type": "chat", - "output_component": "", - "tweaks": null + "output_component": "" }' ``` + + + The response from `/v1/run/$FLOW_ID` includes metadata, inputs, and outputs for the run.
@@ -84,6 +150,77 @@ With `/v1/run/$FLOW_ID`, the flow is executed as a batch with optional LLM token To stream LLM token responses, append the `?stream=true` query parameter to the request: + + + +```python +import requests + +url = "http://LANGFLOW_SERVER_URL/api/v1/run/FLOW_ID?stream=true" + +# Request payload +payload = { + "message": "Tell me something interesting!", + "session_id": "chat-123" +} + +# Request headers +headers = { + "accept": "application/json", + "Content-Type": "application/json", + "x-api-key": "LANGFLOW_API_KEY" +} + +try: + response = requests.post(url, json=payload, headers=headers, stream=True) + response.raise_for_status() + + # Process streaming response + for line in response.iter_lines(): + if line: + print(line.decode('utf-8')) +except requests.exceptions.RequestException as e: + print(f"Error making API request: {e}") +``` + + + + +```js +const payload = { + message: "Tell me something interesting!", + session_id: "chat-123" +}; + +const options = { + method: 'POST', + headers: { + 'accept': 'application/json', + 'Content-Type': 'application/json', + 'x-api-key': 'LANGFLOW_API_KEY' + }, + body: JSON.stringify(payload) +}; + +fetch('http://LANGFLOW_SERVER_URL/api/v1/run/FLOW_ID?stream=true', options) + .then(async response => { + const reader = response.body?.getReader(); + const decoder = new TextDecoder(); + + if (reader) { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + console.log(decoder.decode(value)); + } + } + }) + .catch(err => console.error(err)); +``` + + + + ```bash curl -X POST \ "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID?stream=true" \ @@ -96,6 +233,9 @@ curl -X POST \ }' ``` + + + LLM chat responses are streamed back as `token` events, culminating in a final `end` event that closes the connection.
@@ -132,8 +272,9 @@ The following example is truncated to illustrate a series of `token` events as w | Header | Info | Example | |--------|------|---------| | Content-Type | Required. Specifies the JSON format. | "application/json" | -| accept | Optional. Specifies the response format. | "application/json" | -| x-api-key | Optional. Required only if authentication is enabled. | "sk-..." | +| accept | Optional. Specifies the response format. Defaults to JSON if not specified. | "application/json" | +| x-api-key | Required. Your Langflow API key for authentication. Can be passed as a header or query parameter. | "sk-..." | +| `X-LANGFLOW-GLOBAL-VAR-*` | Optional. Pass global variables to the flow. Variable names are automatically converted to uppercase. These variables take precedence over OS environment variables and are only available during this specific request execution. | `"X-LANGFLOW-GLOBAL-VAR-API_KEY: sk-..."` | ### Run endpoint parameters @@ -150,6 +291,93 @@ The following example is truncated to illustrate a series of `token` events as w ### Request example with all headers and parameters + + + +```python +import requests + +url = "http://LANGFLOW_SERVER_URL/api/v1/run/FLOW_ID?stream=true" + +# Request payload with tweaks +payload = { + "input_value": "Tell me a story", + "input_type": "chat", + "output_type": "chat", + "output_component": "chat_output", + "session_id": "chat-123", + "tweaks": { + "component_id": { + "parameter_name": "value" + } + } +} + +# Request headers +headers = { + "Content-Type": "application/json", + "accept": "application/json", + "x-api-key": "LANGFLOW_API_KEY" +} + +try: + response = requests.post(url, json=payload, headers=headers, stream=True) + response.raise_for_status() + + # Process streaming response + for line in response.iter_lines(): + if line: + print(line.decode('utf-8')) +except requests.exceptions.RequestException as e: + print(f"Error making API request: {e}") +``` + + + + +```js +const payload = { + input_value: "Tell me a story", + input_type: "chat", + output_type: "chat", + output_component: "chat_output", + session_id: "chat-123", + tweaks: { + component_id: { + parameter_name: "value" + } + } +}; + +const options = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'accept': 'application/json', + 'x-api-key': 'LANGFLOW_API_KEY' + }, + body: JSON.stringify(payload) +}; + +fetch('http://LANGFLOW_SERVER_URL/api/v1/run/FLOW_ID?stream=true', options) + .then(async response => { + const reader = response.body?.getReader(); + const decoder = new TextDecoder(); + + if (reader) { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + console.log(decoder.decode(value)); + } + } + }) + .catch(err => console.error(err)); +``` + + + + ```bash curl -X POST \ "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID?stream=true" \ @@ -170,6 +398,103 @@ curl -X POST \ }' ``` + + + +### Pass global variables in request headers {#pass-global-variables-in-headers} + +You can pass global variables to your flow using HTTP headers with the format `X-LANGFLOW-GLOBAL-VAR-{VARIABLE_NAME}`. + +Variables passed in headers take precedence over OS environment variables. If a variable is provided in both a header and an environment variable, the header value is used. Variables are only available during this specific request execution and aren't persisted. + +Variable names are automatically converted to uppercase. For example, `X-LANGFLOW-GLOBAL-VAR-api-key` becomes `API_KEY` in your flow. + +You don't need to create these variables in Langflow's Global Variables section first. Pass any variable name using this header format. + + + + +```python +import requests + +url = "http://LANGFLOW_SERVER_URL/api/v1/run/FLOW_ID" + +# Request payload +payload = { + "input_value": "Tell me about something interesting!", + "input_type": "chat", + "output_type": "chat" +} + +# Request headers with global variables +headers = { + "Content-Type": "application/json", + "x-api-key": "LANGFLOW_API_KEY", + "X-LANGFLOW-GLOBAL-VAR-OPENAI_API_KEY": "sk-...", + "X-LANGFLOW-GLOBAL-VAR-USER_ID": "user123", + "X-LANGFLOW-GLOBAL-VAR-ENVIRONMENT": "production" +} + +try: + response = requests.post(url, json=payload, headers=headers) + response.raise_for_status() + print(response.json()) +except requests.exceptions.RequestException as e: + print(f"Error making API request: {e}") +``` + + + + +```js +const payload = { + input_value: "Tell me about something interesting!", + input_type: "chat", + output_type: "chat" +}; + +const options = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'x-api-key': 'LANGFLOW_API_KEY', + 'X-LANGFLOW-GLOBAL-VAR-OPENAI_API_KEY': 'sk-...', + 'X-LANGFLOW-GLOBAL-VAR-USER_ID': 'user123', + 'X-LANGFLOW-GLOBAL-VAR-ENVIRONMENT': 'production' + }, + body: JSON.stringify(payload) +}; + +fetch('http://LANGFLOW_SERVER_URL/api/v1/run/FLOW_ID', options) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(err => console.error(err)); +``` + + + + +```bash +curl -X POST \ + "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID" \ + -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ + -H "X-LANGFLOW-GLOBAL-VAR-OPENAI_API_KEY: sk-..." \ + -H "X-LANGFLOW-GLOBAL-VAR-USER_ID: user123" \ + -H "X-LANGFLOW-GLOBAL-VAR-ENVIRONMENT: production" \ + -d '{ + "input_value": "Tell me about something interesting!", + "input_type": "chat", + "output_type": "chat" + }' +``` + + + + +If your flow components reference variables that aren't provided in headers or your Langflow database, the flow fails by default. To avoid this, you can set `LANGFLOW_FALLBACK_TO_ENV_VAR=True` in your `.env` file, which allows the flow to use values from OS environment variables if they aren't otherwise specified. + + ## Webhook run flow Use the `/webhook` endpoint to start a flow by sending an HTTP `POST` request. diff --git a/docs/docs/API-Reference/api-monitor.mdx b/docs/docs/API-Reference/api-monitor.mdx index 0f42edc6a..ed320b083 100644 --- a/docs/docs/API-Reference/api-monitor.mdx +++ b/docs/docs/API-Reference/api-monitor.mdx @@ -3,6 +3,9 @@ title: Monitor endpoints slug: /api-monitor --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + The `/monitor` endpoints are for internal Langflow functionality, primarily related to running flows in the **Playground**, storing chat history, and generating flow logs. This information is primarily for those who are building custom components or contributing to the Langflow codebase in a way that requires calling or understanding these endpoints. @@ -630,6 +633,122 @@ HTTP/1.1 204 No Content
+## Get traces + + Retrieve trace metadata and span trees for a specific flow. + +### Example request + +Use `GET /monitor/traces` and filter by `flow_id`: + + + + +```python +import os + +import requests + +base_url = os.getenv("LANGFLOW_SERVER_URL", "http://localhost:7860") +api_key = os.getenv("LANGFLOW_API_KEY") +flow_id = "YOUR_FLOW_ID" + +response = requests.get( + f"{base_url}/api/v1/monitor/traces", + params={"flow_id": flow_id, "page": 1, "size": 50}, + headers={"x-api-key": api_key, "accept": "application/json"}, + timeout=10, +) +response.raise_for_status() +traces = response.json() +print(traces) +``` + + + + +```ts +const baseUrl = process.env.LANGFLOW_SERVER_URL ?? "http://localhost:7860"; +const apiKey = process.env.LANGFLOW_API_KEY!; +const flowId = "YOUR_FLOW_ID"; + +async function listTraces() { + const url = new URL("/api/v1/monitor/traces", baseUrl); + url.searchParams.set("flow_id", flowId); + url.searchParams.set("page", "1"); + url.searchParams.set("size", "50"); + + const res = await fetch(url.toString(), { + headers: { + accept: "application/json", + "x-api-key": apiKey, + }, + }); + + if (!res.ok) { + throw new Error(`Request failed with status ${res.status}`); + } + + const data = await res.json(); + console.log(data); +} + +listTraces().catch(console.error); +``` + + + + +```bash +export LANGFLOW_SERVER_URL="http://localhost:7860" +export LANGFLOW_API_KEY="YOUR_LANGFLOW_API_KEY" +export FLOW_ID="YOUR_FLOW_ID" + +curl -s "$LANGFLOW_SERVER_URL/api/v1/monitor/traces?flow_id=$FLOW_ID&page=1&size=50" \ + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ + | jq . +``` + + + + +### Example response + +```json +{ + "traces": [ + { + "id": "426656db-fc3c-4a3a-acf8-c60acf099543", + "name": "Simple Agent - 9e774f60-857b-44b4-bbcd-87bd23848ee8", + "status": "ok", + "startTime": "2026-03-03T19:13:30.692628Z", + "totalLatencyMs": 18693, + "totalTokens": 2050, + "flowId": "9e774f60-857b-44b4-bbcd-87bd23848ee8", + "sessionId": "9e774f60-857b-44b4-bbcd-87bd23848ee8", + "input": { + "input_value": "Use tools to teach me about vertex graphs" + }, + "output": { + "message": { + "text_key": "text", + "data": { + "timestamp": "2026-03-03 19:13:30 UTC", + "sender": "Machine", + "sender_name": "AI", + "session_id": "9e774f60-857b-44b4-bbcd-87bd23848ee8", + "text": "I can teach you the concept, but I couldn’t pull the Wikipedia pages with the tool ... (truncated)" + } + } + } + } + ], + "total": 1, + "pages": 1 +} +``` + ## Get transactions Retrieve all transactions, which are interactions between components, for a specific flow. diff --git a/docs/docs/API-Reference/api-openai-responses.mdx b/docs/docs/API-Reference/api-openai-responses.mdx index 5ffb828cb..18f117595 100644 --- a/docs/docs/API-Reference/api-openai-responses.mdx +++ b/docs/docs/API-Reference/api-openai-responses.mdx @@ -191,6 +191,7 @@ Fields set dynamically by Langflow: | `model` | `string` | The flow ID that was executed. | | `output` | `list[dict]` | Array of output items (messages, tool calls, etc.). | | `previous_response_id` | `string` | ID of previous response if continuing conversation. | +| `usage` | `dict` | Token usage statistics if the `usage` field is available. Contains `prompt_tokens`, `completion_tokens`, and `total_tokens`. |
Fields with OpenAI-compatible default values @@ -212,7 +213,7 @@ Fields set dynamically by Langflow: | `tools` | `list[dict]` | `[]` | Available tools. | | `top_p` | `float` | `1.0` | Top-p setting. | | `truncation` | `string` | `"disabled"` | Truncation setting. | -| `usage` | `dict` | `null` | Usage statistics (if any). | +| `usage` | `dict` | `null` | Token usage statistics. Set dynamically when available from flow components, otherwise `null`. See [Token usage tracking](#token-usage-tracking). | | `user` | `string` | `null` | User identifier (if any). | | `metadata` | `dict` | `{}` | Additional metadata. | @@ -596,4 +597,123 @@ To avoid this, you can set the `FALLBACK_TO_ENV_VARS` environment variable is `t In the above example, `OPENAI_API_KEY` will fall back to the database variable if not provided in the header. `USER_ID` and `ENVIRONMENT` will fall back to environment variables if `FALLBACK_TO_ENV_VARS` is enabled. -Otherwise, the flow fails. \ No newline at end of file +Otherwise, the flow fails. + +## Token usage tracking {#token-usage-tracking} + +The OpenAI Responses API endpoint tracks token usage when your flow uses language model components that provide token usage information. The `usage` field in the response contains statistics about the number of tokens used for the request and response. + +Token usage is automatically extracted from the flow execution results when the `usage` field is available. +The `usage` field follows OpenAI's format with `prompt_tokens`, `completion_tokens`, and `total_tokens` fields. +If token usage information is not available from the flow components, the `usage` field is `null`. + +The `usage` field is always present in the response, either with token counts or as `null`. The conditional checks shown in the examples below are optional defensive programming to handle cases where usage might not be available. + + + + +```python +from openai import OpenAI + +client = OpenAI( + base_url="LANGFLOW_SERVER_URL/api/v1/", + default_headers={"x-api-key": "LANGFLOW_API_KEY"}, + api_key="dummy-api-key" +) + +response = client.responses.create( + model="FLOW_ID", + input="Explain quantum computing in simple terms" +) + +# Access token usage if available +if response.usage: + print(f"Prompt tokens: {response.usage.get('prompt_tokens', 0)}") + print(f"Completion tokens: {response.usage.get('completion_tokens', 0)}") + print(f"Total tokens: {response.usage.get('total_tokens', 0)}") +else: + print("Token usage not available for this flow") +``` + + + + +```typescript +import OpenAI from "openai"; + +const client = new OpenAI({ + baseURL: "LANGFLOW_SERVER_URL/api/v1/", + defaultHeaders: { + "x-api-key": "LANGFLOW_API_KEY" + }, + apiKey: "dummy-api-key" +}); + +const response = await client.responses.create({ + model: "FLOW_ID", + input: "Explain quantum computing in simple terms" +}); + +// Access token usage if available +if (response.usage) { + console.log(`Prompt tokens: ${response.usage.prompt_tokens || 0}`); + console.log(`Completion tokens: ${response.usage.completion_tokens || 0}`); + console.log(`Total tokens: ${response.usage.total_tokens || 0}`); +} else { + console.log("Token usage not available for this flow"); +} +``` + + + + +```bash +curl -X POST \ + "$LANGFLOW_SERVER_URL/api/v1/responses" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "FLOW_ID", + "input": "Explain quantum computing in simple terms", + "stream": false + }' +``` + +
+Response with token usage + +```json +{ + "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "object": "response", + "created_at": 1756837941, + "status": "completed", + "model": "ced2ec91-f325-4bf0-8754-f3198c2b1563", + "output": [ + { + "type": "message", + "id": "msg_a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "Quantum computing is a type of computing that uses quantum mechanical phenomena...", + "annotations": [] + } + ] + } + ], + "usage": { + "prompt_tokens": 12, + "completion_tokens": 145, + "total_tokens": 157 + }, + "previous_response_id": null +} +``` + +
+ +
+
\ No newline at end of file diff --git a/docs/docs/API-Reference/workflows-api.mdx b/docs/docs/API-Reference/workflows-api.mdx new file mode 100644 index 000000000..2ba2f27c0 --- /dev/null +++ b/docs/docs/API-Reference/workflows-api.mdx @@ -0,0 +1,528 @@ +--- +title: Workflow API (Beta) +slug: /workflow-api +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import PartialAPISetup from '@site/docs/_partial-api-setup.mdx'; + +:::warning Beta Feature +The Workflow API is currently in **Beta**. +The API endpoints and response formats may change in future releases. +::: + +The Workflow API provides programmatic access to execute Langflow workflows synchronously or asynchronously. +Synchronous requests receive complete results immediately upon completion. +Asynchronous requests are queued in the background and will run until complete, or a request is issued to the [Stop Workflow endpoint](#stop-workflow-endpoint). + +The Workflow API is part of the Langflow Developer v2 API and offers enhanced workflow execution capabilities compared to the v1 `/run` endpoint. + + + +## Execute workflows endpoint (synchronous or asynchronous) + +**Endpoint:** + +``` +POST /api/v2/workflows +``` + +**Description:** Execute a workflow synchronously and receive complete results immediately upon completion. +Set `background=false` to make the request synchronous. + +### Example synchronous request + +Execute a workflow synchronously and receive complete results immediately: + + + + +```python +import requests + +url = f"{LANGFLOW_SERVER_URL}/api/v2/workflows" +headers = { + "Content-Type": "application/json", + "x-api-key": LANGFLOW_API_KEY +} + +payload = { + "flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b", + "background": False, + "inputs": { + "ChatInput-abc.input_type": "chat", + "ChatInput-abc.input_value": "what is 2+2", + "ChatInput-abc.session_id": "session-123" + } +} + +response = requests.post(url, json=payload, headers=headers) +print(response.json()) +``` + + + + +```typescript +import axios from 'axios'; + +const url = `${LANGFLOW_SERVER_URL}/api/v2/workflows`; + +const payload = { + flow_id: "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b", + background: false, + inputs: { + "ChatInput-abc.input_type": "chat", + "ChatInput-abc.input_value": "what is 2+2", + "ChatInput-abc.session_id": "session-123" + } +}; + +const runWorkflow = async () => { + try { + const response = await axios.post(url, payload, { + headers: { + 'Content-Type': 'application/json', + 'x-api-key': LANGFLOW_API_KEY + } + }); + console.log(response.data); + } catch (error) { + console.error('Error triggering workflow:', error); + } +}; + +runWorkflow(); +``` + + + + +```bash +curl -X POST \ + "$LANGFLOW_SERVER_URL/api/v2/workflows" \ + -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ + -d '{ + "flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b", + "background": false, + "inputs": { + "ChatInput-abc.input_type": "chat", + "ChatInput-abc.input_value": "what is 2+2", + "ChatInput-abc.session_id": "session-123" + } + }' +``` + + + + +### Example asynchronous request + +For long-running workflows, set `background=true` to get a `job_id` immediately, and then poll the status [using the GET endpoint](#get-workflow-status-endpoint) until the job is complete. + +To stop a job, send a POST request to the [Stop workflow endpoint](#stop-workflow-endpoint). + +:::tip +The asynchronous request contains `stream` parameter, but streaming is not yet supported. The parameter is included for future compatibility. +::: + +**Example request:** + + + + +```python +import requests + +url = f"{LANGFLOW_SERVER_URL}/api/v2/workflows" +headers = { + "Content-Type": "application/json", + "x-api-key": LANGFLOW_API_KEY +} + +payload = { + "flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b", + "background": True, + "stream": False, + "inputs": { + "ChatInput-abc.input_type": "chat", + "ChatInput-abc.input_value": "Process this in the background", + "ChatInput-abc.session_id": "session-456" + } +} + +response = requests.post(url, json=payload, headers=headers) +print(response.json()) # Returns job_id immediately +``` + + + + +```typescript +import axios from 'axios'; + +const url = `${LANGFLOW_SERVER_URL}/api/v2/workflows`; + +const payload = { + flow_id: "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b", + background: true, + stream: false, + inputs: { + "ChatInput-abc.input_type": "chat", + "ChatInput-abc.input_value": "Process this in the background", + "ChatInput-abc.session_id": "session-456" + } +}; + +const runWorkflow = async () => { + try { + const response = await axios.post(url, payload, { + headers: { + 'Content-Type': 'application/json', + 'x-api-key': LANGFLOW_API_KEY + } + }); + console.log(response.data); // Returns job_id immediately + } catch (error) { + console.error('Error triggering workflow:', error); + } +}; + +runWorkflow(); +``` + + + + +```bash +curl -X POST \ + "$LANGFLOW_SERVER_URL/api/v2/workflows" \ + -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ + -d '{ + "flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b", + "background": true, + "stream": false, + "inputs": { + "ChatInput-abc.input_type": "chat", + "ChatInput-abc.input_value": "Process this in the background", + "ChatInput-abc.session_id": "session-456" + } + }' +``` + + + + +**Response:** + +```json +{ + "job_id": "job_id_1234567890", + "created_timestamp": "2025-01-15T10:30:00Z", + "status": "queued", + "errors": [] +} +``` + +### Request body + +| Field | Type | Required | Default | Description | +|-------|------|----------|---------|-------------| +| `flow_id` | `string` | Yes | - | The ID or endpoint name of the flow to execute. | +| `flow_version` | `string` | No | - | Optional version hash to pin to a specific flow version. | +| `background` | `boolean` | No | `false` | Must be `false` for synchronous execution. | +| `inputs` | `object` | No | `{}` | Inputs for the workflow execution. Uses component identifiers with dot notation (e.g., `ChatInput-abc.input_value`). See [Component identifiers and input structure](#component-identifiers-and-input-structure) for detailed information. | + +### Example response + +```json +{ + "flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b", + "job_id": "job_id_1234567890", + "object": "response", + "created_at": 1741476542, + "status": "completed", + "errors": [], + "inputs": { + "ChatInput-abc.input_type": "chat", + "ChatInput-abc.input_value": "what is 2+2", + "ChatInput-abc.session_id": "session-123" + }, + "outputs": { + "ChatOutput-xyz": { + "type": "message", + "component_id": "ChatOutput-xyz", + "status": "completed", + "content": "2 + 2 equals 4." + } + }, + "metadata": {} +} +``` + +### Response body + +The response includes an `outputs` field containing component-level results. Each output has a `type` field indicating the type of content: + +| Type | Description | Example | +|------|-------------|---------| +| `message` | Text message content. | Chat responses, summaries | +| `image` | Image URL or data. | Generated images, processed images | +| `sql` | SQL query results. | Database query outputs | +| `data` | Structured data. | JSON objects, arrays | +| `file` | File reference. | Generated documents, reports | + +## Get workflow status endpoint + +**Endpoint:** `GET /api/v2/workflows` + +**Description:** Retrieve the status and results of a workflow execution by job ID. + +### Example request + + + + +```python +import requests + +url = f"{LANGFLOW_SERVER_URL}/api/v2/workflows" +params = { + "job_id": "job_id_1234567890" +} +headers = { + "accept": "application/json", + "x-api-key": LANGFLOW_API_KEY +} + +response = requests.get(url, params=params, headers=headers) +print(response.json()) +``` + + + + +```typescript +import axios from 'axios'; + +const jobId = 'job_id_1234567890'; +const url = `${LANGFLOW_SERVER_URL}/api/v2/workflows`; + +const getWorkflowStatus = async () => { + try { + const response = await axios.get(url, { + params: { + job_id: jobId + }, + headers: { + 'accept': 'application/json', + 'x-api-key': LANGFLOW_API_KEY + } + }); + console.log(response.data); + } catch (error) { + console.error('Error getting workflow status:', error); + } +}; + +getWorkflowStatus(); +``` + + + + +```bash +curl -X GET \ + "$LANGFLOW_SERVER_URL/api/v2/workflows?job_id=job_id_1234567890" \ + -H "accept: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" +``` + + + + +### Query parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `job_id` | `string` | Yes | The job ID returned from a workflow execution. | +| `stream` | `boolean` | No | If `true`, returns server-sent events stream. Default: `false`. | +| `sequence_id` | `integer` | No | Optional sequence ID to resume streaming from a specific point. | + +### Example response + +```json +{ + "flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b", + "job_id": "job_id_1234567890", + "object": "response", + "created_at": 1741476542, + "status": "completed", + "errors": [], + "outputs": { + "ChatOutput-xyz": { + "type": "message", + "component_id": "ChatOutput-xyz", + "status": "completed", + "content": "Processing complete..." + } + }, + "input": [ + { + "type": "text", + "data": "Input text prompt for the workflow execution", + "role": "User" + } + ], + "metadata": {} +} +``` + +### Response body + +The response includes a `status` field that indicates the current state of the workflow execution: + +| Status | Description | +|--------|-------------| +| `queued` | Job is queued and waiting to start. | +| `in_progress` | Job is currently executing. | +| `completed` | Job completed successfully. | +| `failed` | Job failed during execution. | +| `error` | Job encountered an error. | + +## Stop workflow endpoint + +**Endpoint:** `POST /api/v2/workflows/stop` + +**Description:** Stop a running workflow execution by job ID. + +### Example request + + + + +```python +import requests + +url = f"{LANGFLOW_SERVER_URL}/api/v2/workflows/stop" +headers = { + "Content-Type": "application/json", + "x-api-key": LANGFLOW_API_KEY +} +payload = { + "job_id": "job_id_1234567890" +} + +response = requests.post(url, json=payload, headers=headers) +print(response.json()) +``` + + + + +```typescript +import axios from 'axios'; + +const url = `${LANGFLOW_SERVER_URL}/api/v2/workflows/stop`; + +const payload = { + job_id: "job_id_1234567890" +}; + +const stopWorkflow = async () => { + try { + const response = await axios.post(url, payload, { + headers: { + 'Content-Type': 'application/json', + 'x-api-key': LANGFLOW_API_KEY + } + }); + console.log(response.data); + } catch (error) { + console.error('Error stopping workflow:', error); + } +}; + +stopWorkflow(); +``` + + + + +```bash +curl -X POST \ + "$LANGFLOW_SERVER_URL/api/v2/workflows/stop" \ + -H "Content-Type: application/json" \ + -H "x-api-key: $LANGFLOW_API_KEY" \ + -d '{ + "job_id": "job_id_1234567890" + }' +``` + + + + +### Request body + +| Field | Type | Required | Default | Description | +|-------|------|----------|---------|-------------| +| `job_id` | `string` | Yes | - | The job ID of the workflow to stop. | + +### Example response + +```json +{ + "job_id": "job_id_1234567890", + "message": "Job job_id_1234567890 cancelled successfully." +} +``` + +## Component identifiers and input structure + +The Workflows API uses component identifiers with dot notation to specify inputs for individual components in your workflow. This allows you to pass values to specific components and override component parameters. + +Component identifiers use the format `{component_id}.{parameter_name}`. +When making requests to the Workflows API, include component identifiers in the `inputs` object. +For example, this demonstrates targeting multiple components and their parameters in a single request. + +```json +{ + "flow_id": "your-flow-id", + "inputs": { + "ChatInput-abc.input_type": "chat", + "ChatInput-abc.input_value": "what is 2+2", + "ChatInput-abc.session_id": "session-123", + "OpenSearchComponent-xyz.opensearch_url": "https://opensearch:9200", + "LLMComponent-123.temperature": 0.7, + "LLMComponent-123.max_tokens": 100 + } +} +``` + +To find the component ID in the Langflow UI, open your flow in Langflow, click the component, and then click **Controls**. The component ID is at the top of the **Controls** pane. + +You can override any component's parameters. + +## Error handling + +The API uses standard HTTP status codes to indicate success or failure: + +| Status Code | Description | +|-------------|-------------| +| `200 OK` | Request successful. | +| `400 Bad Request` | Invalid request parameters. | +| `401 Unauthorized` | Invalid or missing API key. | +| `404 Not Found` | Flow not found or developer API disabled. | +| `500 Internal Server Error` | Server error during execution. | +| `501 Not Implemented` | Endpoint not yet implemented. | + +### Error response format + +```json +{ + "detail": "Error message describing what went wrong" +} +``` diff --git a/docs/docs/Agents/agents-tools.mdx b/docs/docs/Agents/agents-tools.mdx index d3c269ab2..5dc189767 100644 --- a/docs/docs/Agents/agents-tools.mdx +++ b/docs/docs/Agents/agents-tools.mdx @@ -151,7 +151,7 @@ An agent can use [custom components](/components-custom-components) as tools. 3. Enable **Tool Mode** in the custom component. 4. Connect the custom component's tool output to the **Agent** component's **Tools** input. -5. Open the
10. Optional: Try a different model or provider to see how the response changes. -For example, if you are using the **Language Model** core component, you could try an Anthropic model. + If you enabled multiple models in Langflow's global **Model Providers** pane, select a different model in the **Language Model** field. To open the **Model Providers** pane, click your profile icon, select **Settings**, and then click