Back to tutorials
For Builders5 min read

Build Your First AI Agent

Learn how to build AI agents with custom tools, APIs, and realtime workflows using Pipecat.

Build Your First AI Agent with Pipecat

Building AI agents traditionally requires managing backend orchestration, tool execution, APIs, routing logic, streaming infrastructure, and deployment systems.

Pipecat simplifies this into a visual workflow builder where you can create, debug, and deploy AI agents directly from a canvas interface. Pipecat supports multiple LLM providers, custom tools, realtime execution, structured outputs, and public APIs — all without writing orchestration code.

In this tutorial, you'll build your first AI agent using the Pipecat visual workflow canvas.


What You'll Build

By the end of this guide you'll learn how to:

  • Create an AI workflow visually
  • Configure your preferred LLM provider
  • Add tools to your agent
  • Customize prompts and execution settings
  • Enable structured outputs
  • Define output schemas
  • Build production-ready AI workflows

Step 1 — Open the Canvas

After signing up and logging into Pipecat, open the workflow canvas.

Pipecat automatically provides a starter workflow:

Input → LLM → Output

This is the core execution graph of your AI agent.

  • The Input node receives user input
  • The LLM node performs reasoning and tool execution
  • The Output node returns the final response

Pipecat makes the agent graph visible directly on the canvas so you can visually understand how your workflow executes in realtime.

Pipecat Canvas


Understanding the Workflow

Every AI agent fundamentally consists of:

  • Input handling
  • Model reasoning
  • Tool execution
  • Output generation

Pipecat converts these concepts into a visual DAG (Directed Acyclic Graph) builder where nodes execute in topological order.

As your workflows grow, you can add:

  • Multiple LLM nodes
  • Custom tools
  • Parallel branches
  • Structured outputs
  • Streaming execution
  • Public APIs

Step 2 — Configure Your LLM

Click on the LLM node to open the configuration panel.

Pipecat supports multiple providers including:

  • OpenAI
  • Anthropic
  • Gemini
  • OpenRouter

You can either:

  • Select a provider
  • Choose a model from the dropdown
  • Or manually enter a custom model ID

This makes it easy to experiment with different models without changing your workflow architecture.

LLM Configuration


Choosing the Right Model

Different models are optimized for different tasks.

Use CaseSuggested Models
Fast chat agentsGPT-4.1 Mini, Claude Haiku
Deep reasoningClaude Sonnet, GPT-4.1
Cost optimizationGemini Flash
Open-source routingOpenRouter

Pipecat allows you to switch models instantly from the canvas without rebuilding the workflow.


Step 3 — Configure Tools

AI agents become significantly more powerful when they can interact with external systems.

Pipecat allows LLM nodes to call tools during execution.

To configure tools:

  1. Click the LLM node
  2. Click Add Tool
  3. Select the tool you created earlier

These tools can include:

  • HTTP APIs
  • Internal backend services
  • Search systems
  • Databases
  • External integrations

Pipecat automatically exposes these tools to the LLM during execution.

Tool Configuration


Create Custom Tools First

If you haven't created tools yet, follow the custom tools guide first.

How to Create Custom Tools in Pipecat

This guide covers:

  • Tool schemas
  • HTTP integrations
  • Parameters
  • Authentication
  • Tool execution flows

Step 4 — Configure Prompt and Execution Settings

Inside the LLM configuration panel you can also customize advanced settings.


Max Output Tokens

Controls the maximum response length generated by the model.

Higher values:

  • Allow longer responses
  • Increase cost and latency

Lower values:

  • Reduce token usage
  • Improve response speed

Max Output Iterations

Controls how many reasoning or tool execution cycles the agent can perform before finishing.

This is useful for:

  • Multi-step workflows
  • Tool-heavy agents
  • Research pipelines
  • Retrieval systems

Customize the Prompt

You can fully customize the system prompt used by the model.

Example:

You are a helpful AI assistant specialized in customer support.
Always respond professionally and concisely.

Prompt engineering has a massive impact on:

  • Tool usage behavior
  • Response quality
  • Structured outputs
  • Hallucination reduction

Prompt Editor


Step 5 — Enable Structured Output

Structured outputs allow your AI agent to return predictable JSON responses instead of plain text.

This is extremely useful when building:

  • APIs
  • Frontend integrations
  • Workflow systems
  • Automations
  • Data extraction pipelines

To enable structured output:

  1. Click the Output node
  2. Enable the Structured Output toggle

Structured Output Toggle


Step 6 — Define Output Fields

Once structured output is enabled, you can define output fields manually.

Each field contains:

  • Name
  • Type
  • Description

The description helps the LLM understand what kind of response should be generated.

Example schema:

FieldTypeDescription
summarystringShort summary of the response
confidencenumberConfidence score between 0 and 1
sourcesarrayList of referenced sources

Pipecat then guides the model to generate responses matching this schema.

Output Schema Editor


Why Structured Outputs Matter

Without structured outputs, AI responses can vary heavily in formatting.

Structured outputs make AI agents:

  • Reliable
  • Machine-readable
  • API-friendly
  • Easier to automate

This becomes extremely important for:

  • Agent orchestration
  • Workflow pipelines
  • Frontend rendering
  • Automation systems
  • AI integrations

Realtime Streaming and Execution

Pipecat supports realtime execution streaming directly on the canvas.

As workflows execute you can see:

  • Live node states
  • Tool execution
  • Streaming responses
  • Parallel execution
  • Realtime updates

This makes debugging significantly easier compared to manually orchestrating AI systems in backend code.


Final Thoughts

Pipecat makes AI workflow orchestration visual, scalable, and production-ready.

Instead of manually wiring together:

  • APIs
  • Tool execution
  • Streaming systems
  • Routing logic
  • Structured outputs

you can build everything directly from the canvas interface.

Pipecat supports:

  • Realtime streaming
  • Public APIs
  • Custom tools
  • Parallel execution
  • Structured outputs
  • Multi-provider LLM orchestration

This allows you to move from prototype to production significantly faster.


Next Tutorial

Continue learning with:

How to Create Custom Tools in Pipecat

Ready to start building?

Join Pipecat today and transform your store with AI.

Get started for free