Skip to main content
LangChain provides Python building blocks — LLMChain, AgentExecutor, LCEL pipes — for constructing AI workflows locally. The Swarms API replaces this entire stack with a single REST endpoint: you describe your agents and workflow in JSON and the API handles orchestration, model routing, retries, and billing.

Side-by-Side: Simple LLMChain

LangChain

Swarms API


Side-by-Side: SequentialChain (LCEL Pipe)

LangChain

Swarms API

No lambdas or output-passing glue code needed — the sequential workflow passes each agent’s output to the next automatically.

Side-by-Side: RunnableParallel

LangChain

Swarms API


Side-by-Side: AgentExecutor with Tools

LangChain

Swarms API

The built-in tools_enabled values are currently auto_search and web_scraper; call GET /v1/tools/available to fetch the current list, or attach custom function tools via tools_list_dictionary.

Side-by-Side: Streaming

LangChain

Swarms API

See the Streaming guide for full details.

Prompt Templates → System Prompts

LangChain’s ChatPromptTemplate separates system messages from human messages. In the Swarms API, system instructions go in system_prompt and the user’s request goes in task.

LangChain

Swarms API

Variables that were filled in via ChatPromptTemplate are simply inlined into the system_prompt string.

Structured Output

LangChain

Swarms API

There is no dedicated response_format field on the Swarms API — structured JSON output is achieved by instructing the model in system_prompt (as above), then parsing the returned text yourself.

Memory and Conversation History

LangChain’s ConversationBufferMemory persists chat history between chain calls. The Swarms API is stateless — maintain history externally and pass it in the task field.

LangChain

Swarms API


Key Differences to Keep in Mind