Files
langflow/docs/docs/Get-Started/get-started-quickstart.mdx
Mendon Kissling d43bf3f588 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 <edwin.jose@datastax.com>

* 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] <github-actions[bot]@users.noreply.github.com>

* 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 a0d5618ac9.

* [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 <edwin.jose@datastax.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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>
2026-03-06 14:41:10 +00:00

572 lines
21 KiB
Plaintext

---
title: Quickstart
slug: /get-started-quickstart
---
import Icon from "@site/src/components/icon";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import PartialGlobalModelProviders from '@site/docs/_partial-global-model-providers.mdx';
Get started with Langflow by loading a template flow, running it, and then serving it at the `/run` API endpoint.
## Prerequisites
- [Install and start Langflow](/get-started-installation)
- Create an [OpenAI API key](https://platform.openai.com/api-keys)
- Create a [Langflow API key](/api-keys-and-authentication)
<details>
<summary>Create a Langflow API key</summary>
A Langflow API key is a user-specific token you can use with Langflow.
To create a Langflow API key, do the following:
1. In Langflow, click your user icon, and then select **Settings**.
2. Click **Langflow API Keys**, and then click <Icon name="Plus" aria-hidden="true"/> **Add New**.
3. Name your key, and then click **Create API Key**.
4. Copy the API key and store it securely.
5. To use your Langflow API key in a request, set a `LANGFLOW_API_KEY` environment variable in your terminal, and then include an `x-api-key` header or query parameter with your request.
For example:
```bash
# Set variable
export LANGFLOW_API_KEY="sk..."
# Send request
curl --request POST \
--url "http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID" \
--header "Content-Type: application/json" \
--header "x-api-key: $LANGFLOW_API_KEY" \
--data '{
"output_type": "chat",
"input_type": "chat",
"input_value": "Hello"
}'
```
</details>
:::tip
If you encounter the error "An API key must be passed as query or header" when attempting to sign up, see [Troubleshooting](/troubleshoot#an-api-key-must-be-passed-as-query-or-header).
:::
## Run the Simple Agent template flow
1. In Langflow, click **New Flow**, and then select the **Simple Agent** template.
![Simple Agent template](/img/quickstart-simple-agent-flow.png)
The **Simple Agent** template consists of an [**Agent** component](/agents) connected to [**Chat Input** and **Chat Output** components](/chat-input-and-output), a [**Calculator** component](/calculator), and a [**URL** component](/url). When you run this flow, you submit a query to the agent through the **Chat Input** component, the agent uses the **Calculator** and **URL** tools to generate a response, and then returns the response through the **Chat Output** component.
Many components can be tools for agents, including [Model Context Protocol (MCP) servers](/mcp-server). The agent decides which tools to call based on the context of a given query.
2. In the **Agent** component, click **Setup Provider** to select your language model provider.
<PartialGlobalModelProviders />
3. In the **Agent** component, select your configured model from the **Language Model** dropdown.
<details>
<summary>Access more models and providers</summary>
There are two ways to access more models and providers:
* Edit Langflow's global <Icon name="BrainCog" aria-hidden="true" /> **Models** configuration. These providers and models are part of Langflow's core functionality. Use the **Ollama** provider to connect to any model hosted on a local or remote Ollama instance.
* Connect any [additional language model component](/components-models#additional-language-models) to the **Agent** component's **Language Model** port.
</details>
4. To run the flow, click <Icon name="Play" aria-hidden="true"/> **Playground**.
5. To test the **Calculator** tool, ask the agent a simple math question, such as `I want to add 4 and 4.`
To help you test and evaluate your flows, the **Playground** shows the agent's reasoning process as it analyzes the prompt, selects a tool, and then uses the tool to generate a response.
In this case, a math question causes the agent to select the **Calculator** tool and use an action like `evaluate_expression`.
![Playground with Agent tool](/img/quickstart-simple-agent-playground.png)
6. To test the **URL** tool, ask the agent about current events.
For this request, the agent selects the **URL** tool's `fetch_content` action, and then returns a summary of current news headlines.
7. When you are done testing the flow, click <Icon name="X" aria-hidden="true"/>**Close**.
:::tip Next steps
Now that you've run your first flow, try these next steps:
- Edit your **Simple Agent** flow by attaching different tools or adding more [components](/concepts-components) to the flow.
- [Build your own flows](/concepts-flows) from scratch or by modifying other template flows.
- Integrate flows into your applications, as explained in [Run your flows from external applications](#run-your-flows-from-external-applications).
:::
## Run your flows from external applications
Langflow is an IDE, but it's also a runtime you can call through the [Langflow API](/api-reference-api-examples) with Python, JavaScript, or HTTP.
When you start Langflow locally, you can send requests to the local Langflow server.
For production applications, you need to [deploy a stable Langflow instance](/deployment-overview) to handle API calls.
For example, you can use the `/run` endpoint to run a flow and get the result.
Langflow provides code snippets to help you get started with the Langflow API.
1. When editing a flow, click **Share**, and then click **API access**.
The default code in the API access pane constructs a request with the Langflow server `url`, `headers`, and a `payload` of request data.
The code snippets automatically include the `LANGFLOW_SERVER_ADDRESS` and `FLOW_ID` values for the flow, and a script to include your `LANGFLOW_API_KEY` if you've set it as an environment variable in your terminal session.
Replace these values if you're using the code for a different server or flow.
The default Langflow server address is `http://localhost:7860`.
<Tabs>
<TabItem value="Python" label="Python" default>
```python
import requests
url = "http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID" # The complete API endpoint URL for this flow
# Request payload configuration
payload = {
"output_type": "chat",
"input_type": "chat",
"input_value": "hello world!"
}
# Request headers
headers = {
"Content-Type": "application/json",
"x-api-key": "$LANGFLOW_API_KEY"
}
try:
# Send API request
response = requests.request("POST", url, json=payload, headers=headers)
response.raise_for_status() # Raise exception for bad status codes
# Print response
print(response.text)
except requests.exceptions.RequestException as e:
print(f"Error making API request: {e}")
except ValueError as e:
print(f"Error parsing response: {e}")
```
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
```js
const payload = {
"output_type": "chat",
"input_type": "chat",
"input_value": "hello world!",
"session_id": "user_1"
};
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'LANGFLOW_API_KEY'
},
body: JSON.stringify(payload)
};
fetch('http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
```
</TabItem>
<TabItem value="curl" label="curl">
```bash
curl --request POST \
--url 'http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID?stream=false' \
--header 'Content-Type: application/json' \
--header "x-api-key: LANGFLOW_API_KEY" \
--data '{
"output_type": "chat",
"input_type": "chat",
"input_value": "hello world!"
}'
# A 200 response confirms the call succeeded.
```
</TabItem>
</Tabs>
2. Copy the snippet, paste it in a script file, and then run the script to send the request.
If you are using the curl snippet, you can run the command directly in your terminal.
If the request is successful, the response includes many details about the flow run, including the session ID, inputs, outputs, components, durations, and more.
The following is an example of a response from running the **Simple Agent** template flow:
<details>
<summary>Result</summary>
```json
{
"session_id": "29deb764-af3f-4d7d-94a0-47491ed241d6",
"outputs": [
{
"inputs": {
"input_value": "hello world!"
},
"outputs": [
{
"results": {
"message": {
"text_key": "text",
"data": {
"timestamp": "2025-06-16 19:58:23 UTC",
"sender": "Machine",
"sender_name": "AI",
"session_id": "29deb764-af3f-4d7d-94a0-47491ed241d6",
"text": "Hello world! 🌍 How can I assist you today?",
"files": [],
"error": false,
"edit": false,
"properties": {
"text_color": "",
"background_color": "",
"edited": false,
"source": {
"id": "Agent-ZOknz",
"display_name": "Agent",
"source": "gpt-4o-mini"
},
"icon": "bot",
"allow_markdown": false,
"positive_feedback": null,
"state": "complete",
"targets": []
},
"category": "message",
"content_blocks": [
{
"title": "Agent Steps",
"contents": [
{
"type": "text",
"duration": 2,
"header": {
"title": "Input",
"icon": "MessageSquare"
},
"text": "**Input**: hello world!"
},
{
"type": "text",
"duration": 226,
"header": {
"title": "Output",
"icon": "MessageSquare"
},
"text": "Hello world! 🌍 How can I assist you today?"
}
],
"allow_markdown": true,
"media_url": null
}
],
"id": "f3d85d9a-261c-4325-b004-95a1bf5de7ca",
"flow_id": "29deb764-af3f-4d7d-94a0-47491ed241d6",
"duration": null
},
"default_value": "",
"text": "Hello world! 🌍 How can I assist you today?",
"sender": "Machine",
"sender_name": "AI",
"files": [],
"session_id": "29deb764-af3f-4d7d-94a0-47491ed241d6",
"timestamp": "2025-06-16T19:58:23+00:00",
"flow_id": "29deb764-af3f-4d7d-94a0-47491ed241d6",
"error": false,
"edit": false,
"properties": {
"text_color": "",
"background_color": "",
"edited": false,
"source": {
"id": "Agent-ZOknz",
"display_name": "Agent",
"source": "gpt-4o-mini"
},
"icon": "bot",
"allow_markdown": false,
"positive_feedback": null,
"state": "complete",
"targets": []
},
"category": "message",
"content_blocks": [
{
"title": "Agent Steps",
"contents": [
{
"type": "text",
"duration": 2,
"header": {
"title": "Input",
"icon": "MessageSquare"
},
"text": "**Input**: hello world!"
},
{
"type": "text",
"duration": 226,
"header": {
"title": "Output",
"icon": "MessageSquare"
},
"text": "Hello world! 🌍 How can I assist you today?"
}
],
"allow_markdown": true,
"media_url": null
}
],
"duration": null
}
},
"artifacts": {
"message": "Hello world! 🌍 How can I assist you today?",
"sender": "Machine",
"sender_name": "AI",
"files": [],
"type": "object"
},
"outputs": {
"message": {
"message": "Hello world! 🌍 How can I assist you today?",
"type": "text"
}
},
"logs": {
"message": []
},
"messages": [
{
"message": "Hello world! 🌍 How can I assist you today?",
"sender": "Machine",
"sender_name": "AI",
"session_id": "29deb764-af3f-4d7d-94a0-47491ed241d6",
"stream_url": null,
"component_id": "ChatOutput-aF5lw",
"files": [],
"type": "text"
}
],
"timedelta": null,
"duration": null,
"component_display_name": "Chat Output",
"component_id": "ChatOutput-aF5lw",
"used_frozen_result": false
}
]
}
]
}
```
</details>
In a production application, you probably want to select parts of this response to return to the user, store in logs, and so on. The next steps demonstrate how you can extract data from a Langflow API response to use in your application.
### Extract data from the response
The following example builds on the API pane's example code to create a question-and-answer chat in your terminal that stores the agent's previous answer.
1. Incorporate your **Simple Agent** flow's `/run` snippet into the following script.
This script runs a question-and-answer chat in your terminal and stores the agent's previous answer so you can compare them.
<Tabs>
<TabItem value="Python" label="Python" default>
```python
import requests
import json
url = "http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID"
def ask_agent(question):
payload = {
"output_type": "chat",
"input_type": "chat",
"input_value": question,
}
headers = {
"Content-Type": "application/json",
"x-api-key": "LANGFLOW_API_KEY"
}
try:
response = requests.post(url, json=payload, headers=headers)
response.raise_for_status()
# Get the response message
data = response.json()
message = data["outputs"][0]["outputs"][0]["outputs"]["message"]["message"]
return message
except Exception as e:
return f"Error: {str(e)}"
def extract_message(data):
try:
return data["outputs"][0]["outputs"][0]["outputs"]["message"]["message"]
except (KeyError, IndexError):
return None
# Store the previous answer from ask_agent response
previous_answer = None
# the terminal chat
while True:
# Get user input
print("\nAsk the agent anything, such as 'What is 15 * 7?' or 'What is the capital of France?')")
print("Type 'quit' to exit or 'compare' to see the previous answer")
user_question = input("Your question: ")
if user_question.lower() == 'quit':
break
elif user_question.lower() == 'compare':
if previous_answer:
print(f"\nPrevious answer was: {previous_answer}")
else:
print("\nNo previous answer to compare with!")
continue
# Get and display the answer
result = ask_agent(user_question)
print(f"\nAgent's answer: {result}")
# Store the answer for comparison
previous_answer = result
```
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
```js
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const url = 'http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID';
// Store the previous answer from askAgent response
let previousAnswer = null;
// the agent flow, with question as input_value
async function askAgent(question) {
const payload = {
"output_type": "chat",
"input_type": "chat",
"input_value": question
};
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'LANGFLOW_API_KEY'
},
body: JSON.stringify(payload)
};
try {
const response = await fetch(url, options);
const data = await response.json();
// Extract the message from the nested response
const message = data.outputs[0].outputs[0].outputs.message.message;
return message;
} catch (error) {
return `Error: ${error.message}`;
}
}
// the terminal chat
async function startChat() {
console.log("\nAsk the agent anything, such as 'What is 15 * 7?' or 'What is the capital of France?'");
console.log("Type 'quit' to exit or 'compare' to see the previous answer");
const askQuestion = () => {
rl.question('\nYour question: ', async (userQuestion) => {
if (userQuestion.toLowerCase() === 'quit') {
rl.close();
return;
}
if (userQuestion.toLowerCase() === 'compare') {
if (previousAnswer) {
console.log(`\nPrevious answer was: ${previousAnswer}`);
} else {
console.log("\nNo previous answer to compare with!");
}
askQuestion();
return;
}
const result = await askAgent(userQuestion);
console.log(`\nAgent's answer: ${result}`);
previousAnswer = result;
askQuestion();
});
};
askQuestion();
}
startChat();
```
</TabItem>
</Tabs>
2. To view the agent's previous answer, type `compare`. To close the terminal chat, type `exit`.
### Use tweaks to apply temporary overrides to a flow run
You can include tweaks with your requests to temporarily modify flow parameters.
Tweaks are added to the API request, and temporarily change component parameters within your flow.
Tweaks override the flow's components' settings for a single run only.
They don't modify the underlying flow configuration or persist between runs.
Tweaks are added to the `/run` endpoint's `payload`.
To assist with formatting, you can define tweaks in Langflow's **Input Schema** pane before copying the code snippet.
1. To open the **Input Schema** pane, from the **API access** pane, click **Input Schema**.
2. In the **Input Schema** pane, select the parameter you want to modify in your next request.
Enabling parameters in the **Input Schema** pane doesn't permanently change the listed parameters. It only adds them to the sample code snippets.
3. For example, to change the agent's LLM model from OpenAI to Anthropic and include your Anthropic API key with the request, select the **Agent** component in the **Input Schema** pane and enable the **Language Model** field.
Langflow updates the `tweaks` object in the code snippets based on your input parameters, and includes default values to guide you.
Use the updated code snippets in your script to run your flow with your overrides.
```json
payload = {
"output_type": "chat",
"input_type": "chat",
"input_value": "hello world!",
"tweaks": {
"Agent-ZOknz": {
"agent_llm": "Anthropic",
"api_key": "ANTHROPIC_API_KEY",
"model_name": "claude-opus-4-5-20251101"
}
}
}
```
## Next steps
* [Trigger flows with the Langflow API](/concepts-publish)
* [Use Langflow as a Model Context Protocol (MCP) server](/mcp-server)
* [Containerize a Langflow application](/develop-application)
* [File management](/concepts-file-management)