Skip to main content

Agents

Langflow's Agent and MCP Tools components are critical for building agent flows. These components define the behavior and capabilities of AI agents in your flows.

How do agents work?

Agents extend Large Language Models (LLMs) by integrating tools, which are functions that provide additional context and enable autonomous task execution. These integrations make agents more specialized and powerful than standalone LLMs.

Whereas an LLM might generate acceptable, inert responses to general queries and tasks, an agent can leverage the integrated context and tools to provide more relevant responses and even take action. For example, you might create an agent that can access your company's knowledge base, repositories, and other resources to help your team with tasks that require knowledge of your specific products, customers, and code.

Agents use LLMs as a reasoning engine to process input, determine which actions to take to address the query, and then generate a response. The response could be a typical text-based LLM response, or it could involve an action, like editing a file, running a script, or calling an external API.

In an agentic context, tools are functions that the agent can run to perform tasks or access external resources. A function is wrapped as a Tool object with a common interface that the agent understands. Agents become aware of tools through tool registration, which is when the agent is provided a list of available tools typically at agent initialization. The Tool object's description tells the agent what the tool can do so that it can decide whether the tool is appropriate for a given request.

Examples of agent flows

For examples of flows using the Agent and MCP Tools components, see the following:

  • Langflow quickstart: Start with the Simple Agent template, modify its tools, and then learn how to use an agent flow in an application.

    The Simple Agent template creates a basic agent flow with an Agent component that can use two other Langflow components as tools. The LLM specified in the Agent component's settings can use its own built-in functionality as well as the functionality provided by the connected tools when generating responses.

  • Use an agent as a tool: Create a multi-agent flow.

  • Use Langflow as an MCP client and Use Langflow as an MCP server: Use the Agent and MCP Tools components to implement the Model Context Protocol (MCP) in your flows.

Agent component

The Agent component is the primary agent actor in your agent flows. This component uses an LLM integration to respond to input, such as a chat message or file upload.

The agent can use the tools already available in the base LLM model as well as additional tools that you connect to the Agent component's Tools port. You can connect any Langflow component as a tool, including other Agent components and MCP servers through the MCP Tools component.

For more information about using this component, see Use Langflow agents.

MCP Tools component

The MCP Tools component connects to a Model Context Protocol (MCP) server and exposes the MCP server's functions as tools for Langflow agents to use to respond to input.

In addition to publicly available MCP servers and your own custom-built MCP servers, you can connect Langflow MCP servers, which allow your agent to use your Langflow flows as tools. To do this, use the MCP Tools component's SSE mode to connect to your Langflow MCP server at the /api/v1/mcp/sse endpoint.

For more information about using this component and serving flows as MCP tools, see Use Langflow as an MCP client and Use Langflow as an MCP server.

Earlier versions of the MCP Tools component
  • In Langflow version 1.5, the MCP Connection component was renamed to the MCP Tools component.
  • In Langflow version 1.3, the MCP Tools (stdio) and MCP Tools (SSE) components were deprecated and replaced by the unified MCP Connection component, which was later renamed to MCP Tools.

Legacy Agent components

The following components are legacy components. You can still use these components in your flows, but they are no longer maintained and they can be removed in future releases.

Replace these components with the Agent component or other Langflow components, depending on your use case.

  • CrewAI Hierarchical Task
  • CrewAI Sequential Task
CrewAI Agent

This component represents CrewAI agents, allowing for the creation of specialized AI agents with defined roles goals and capabilities within a crew. For more information, see the CrewAI agents documentation.

This component accepts the following parameters:

NameDisplay NameInfo
roleRoleInput parameter. The role of the agent.
goalGoalInput parameter. The objective of the agent.
backstoryBackstoryInput parameter. The backstory of the agent.
toolsToolsInput parameter. The tools at the agent's disposal.
llmLanguage ModelInput parameter. The language model that runs the agent.
memoryMemoryInput parameter. This determines whether the agent should have memory or not.
verboseVerboseInput parameter. This enables verbose output.
allow_delegationAllow DelegationInput parameter. This determines whether the agent is allowed to delegate tasks to other agents.
allow_code_executionAllow Code ExecutionInput parameter. This determines whether the agent is allowed to execute code.
kwargskwargsInput parameter. Additional keyword arguments for the agent.
outputAgentOutput parameter. The constructed CrewAI Agent object.
CrewAI Hierarchical Crew

This component represents a group of agents managing how they should collaborate and the tasks they should perform in a hierarchical structure. This component allows for the creation of a crew with a manager overseeing the task execution. For more information, see the CrewAI hierarchical crew documentation.

It accepts the following parameters:

NameDisplay NameInfo
agentsAgentsInput parameter. The list of Agent objects representing the crew members.
tasksTasksInput parameter. The list of HierarchicalTask objects representing the tasks to be executed.
manager_llmManager LLMInput parameter. The language model for the manager agent.
manager_agentManager AgentInput parameter. The specific agent to act as the manager.
verboseVerboseInput parameter. This enables verbose output for detailed logging.
memoryMemoryInput parameter. The memory configuration for the crew.
use_cacheUse CacheInput parameter. This enables caching of results.
max_rpmMax RPMInput parameter. This sets the maximum requests per minute.
share_crewShare CrewInput parameter. This determines if the crew information is shared among agents.
function_calling_llmFunction Calling LLMInput parameter. The language model for function calling.
crewCrewOutput parameter. The constructed Crew object with hierarchical task execution.
CrewAI Sequential Crew

This component represents a group of agents with tasks that are executed sequentially. This component allows for the creation of a crew that performs tasks in a specific order. For more information, see the CrewAI sequential crew documentation.

It accepts the following parameters:

NameDisplay NameInfo
tasksTasksInput parameter. The list of SequentialTask objects representing the tasks to be executed.
verboseVerboseInput parameter. This enables verbose output for detailed logging.
memoryMemoryInput parameter. The memory configuration for the crew.
use_cacheUse CacheInput parameter. This enables caching of results.
max_rpmMax RPMInput parameter. This sets the maximum requests per minute.
share_crewShare CrewInput parameter. This determines if the crew information is shared among agents.
function_calling_llmFunction Calling LLMInput parameter. The language model for function calling.
crewCrewOutput parameter. The constructed Crew object with sequential task execution.
CrewAI Sequential Task Agent

This component creates a CrewAI Task and its associated agent allowing for the definition of sequential tasks with specific agent roles and capabilities. For more information, see the CrewAI sequential agents documentation.

It accepts the following parameters:

NameDisplay NameInfo
roleRoleInput parameter. The role of the agent.
goalGoalInput parameter. The objective of the agent.
backstoryBackstoryInput parameter. The backstory of the agent.
toolsToolsInput parameter. The tools at the agent's disposal.
llmLanguage ModelInput parameter. The language model that runs the agent.
memoryMemoryInput parameter. This determines whether the agent should have memory or not.
verboseVerboseInput parameter. This enables verbose output.
allow_delegationAllow DelegationInput parameter. This determines whether the agent is allowed to delegate tasks to other agents.
allow_code_executionAllow Code ExecutionInput parameter. This determines whether the agent is allowed to execute code.
agent_kwargsAgent kwargsInput parameter. The additional kwargs for the agent.
task_descriptionTask DescriptionInput parameter. The descriptive text detailing the task's purpose and execution.
expected_outputExpected Task OutputInput parameter. The clear definition of the expected task outcome.
async_executionAsync ExecutionInput parameter. Boolean flag indicating asynchronous task execution.
previous_taskPrevious TaskInput parameter. The previous task in the sequence for chaining.
task_outputSequential TaskOutput parameter. The list of SequentialTask objects representing the created tasks.

See also

Search