Introduction to Agentic Patterns

Welcome to the next step of your journey towards building effective agents! In our previous courses, you've built a solid foundation by exploring basic workflows with simple LLM calls, then progressing to integrate tools and create autonomous agents that can make decisions and execute tasks independently.Now we're taking the next major leap: agentic patterns. These are sophisticated workflows that leverage the power of autonomous agents working together in coordinated ways to solve complex problems.

In this lesson, we'll focus on agentic pipelines — one of the most fundamental and powerful agentic patterns. You'll learn how to design specialized agents, connect them in sequence, and create workflows where each agent contributes its unique expertise to produce comprehensive solutions. By the end of this lesson, you'll have built a complete three-agent pipeline that can tackle complex multi-step mathematical problems with remarkable clarity and precision.

What Are Agentic Pipelines?

An agentic pipeline is a workflow where multiple specialized autonomous agents work together in sequence, with each agent performing its specific role before passing the results to the next agent in the chain. This differs fundamentally from simple LLM prompt chaining in several crucial ways.

In basic prompt chaining, you send a series of prompts to an LLM, where each prompt builds on the previous response. The LLM processes each prompt independently without specialized context, tools, or persistent expertise. It's like asking the same person to wear different hats for each task — they might do okay, but they're not truly specialized.

Agentic pipelines, however, use autonomous agents that are each designed with specific expertise, dedicated tools, and focused system prompts. Each agent can perform multiple internal steps, make decisions about how to approach their part of the problem, and use tools autonomously. Importantly, within the pipeline, a single agent might take several internal steps — analyzing, planning, using tools, and refining its approach — before generating a final result that gets chained to the next agent. This means each stage of the pipeline can be as sophisticated as needed, while the overall flow remains clean and manageable.

Agent Specialization Principles

The foundation of effective agentic pipelines lies in proper agent specialization. Each agent should be designed as an expert in its specific domain, with clear boundaries about what it should and shouldn't do. This specialization is what transforms a simple sequence of LLM calls into a powerful, coordinated system.

When designing specialized agents, follow these key principles:

  • Single Responsibility: Each agent should have one clear, focused role and excel at that specific task
  • Appropriate Tools: Provide only the tools that are relevant to the agent's specific function
  • Focused System Prompt: Write system prompts that clearly define what the agent should do, what it should avoid, and how it should format outputs
  • Clear Boundaries: Explicitly state what the agent should not attempt, preventing scope creep
  • Output Formatting: Ensure each agent's output is structured to work seamlessly with the next agent in the pipeline

This separation of concerns makes each agent more reliable and the overall system easier to debug and maintain. The system prompt is particularly crucial for specialization, as it acts like a job description that keeps the agent focused on its expertise while ensuring its outputs integrate smoothly with the rest of the pipeline.

What We'll Build

In this lesson, we'll construct a sophisticated three-agent pipeline that can solve complex multi-step mathematical problems. Our pipeline will consist of:

  1. Problem Analyzer Agent - Breaks down complex problems into clear, sequential steps
  2. Calculator Agent - Executes mathematical operations using specialized tools
  3. Solution Presenter Agent - Formats results into educational, easy-to-understand solutions

By the end, you'll see how three specialized agents working together can produce more comprehensive and reliable results than a single general-purpose agent attempting to handle everything at once.

Setting Up Tools and Agent Class

Before we build our pipeline agents, let's quickly set up the necessary imports and tools:

Now we're ready to build our specialized agents for the pipeline.

Building the Problem Analyzer Agent

Let's start building our pipeline with the first agent — the Problem Analyzer. This agent's job is to take complex problems and break them down into clear, actionable steps without performing any calculations itself.

Notice how this agent has no tools at all — this is intentional because we want it to focus purely on analysis and planning. The system prompt explicitly tells it not to perform calculations, which helps maintain clear boundaries between agents. This focused approach ensures our analyzer will create structured plans that the next agent can easily follow.

Building the Calculator Agent

The second agent in our pipeline is the Calculator Agent, which takes the analysis plan and executes all the mathematical operations using the available tools.

This agent has access to all the mathematical tools (sum_numbers, multiply_numbers, subtract_numbers, etc.), but its system prompt focuses it on execution rather than planning. The emphasis on showing work and providing structured results ensures the next agent in the pipeline has clear information to work with.

Building the Solution Presenter Agent

The final agent in our pipeline is the Solution Presenter, which takes the raw calculation results and formats them into a clear, educational solution that's easy to understand.

Like the Problem Analyzer, this agent has no tools because its job is purely communicative. It focuses on taking technical calculation results and transforming them into human-friendly explanations that emphasize educational value. Now that we have our three specialized agents, let's see how they connect together in our pipeline.

Stage 1: Problem Analysis

Let's start our pipeline by running the Problem Analyzer agent with a complex mathematical problem:

Remember that the run method of our Agent class returns two values: the updated message history (useful for continuing conversations with the same agent, though we won't need that in this pipeline example since each agent is used once), and the final text output that we'll pass to the next stage.

When we run this first stage, the Problem Analyzer breaks down our multi-step problem into a clear, structured plan:

Notice how the Problem Analyzer successfully identified all the necessary steps and formulas without performing any calculations. This structured plan now becomes the input for our Calculator Agent in the next stage.

Stage 2: Mathematical Calculations

Now we pass the analysis plan to our Calculator Agent to execute all the mathematical operations:

The Calculator Agent takes the structured plan and methodically executes each calculation using its mathematical tools:

Notice how the tool logs show exactly which mathematical functions were called during the calculation process. The Calculator Agent successfully executed all the mathematical operations using its tools and provided clear numerical results. These calculation results now flow to our final agent for presentation.

Stage 3: Solution Presentation

Finally, we use the Solution Presenter to format the results into a comprehensive, educational solution:

The Solution Presenter transforms the raw calculations into a polished, educational explanation:

This final stage demonstrates how the Solution Presenter takes technical calculation results and transforms them into a clear, educational explanation that shows the reasoning behind each step. Our three-agent pipeline has successfully tackled a complex multi-step problem through specialized collaboration, with each agent contributing its unique expertise to produce a comprehensive solution.

Reflecting on Pipeline Architecture

Notice what we accomplished architecturally: we defined a simple three-stage sequence (analyze → calculate → present), while each agent handled significant internal complexity we didn't need to manage. The Calculator Agent made multiple tool calls and formatting decisions internally, but we only orchestrated the high-level flow between agents.

This separation of orchestration from execution makes complex problems manageable — you focus on workflow while each agent handles its domain expertise.

We could specialize our agents further with additional tools:

  • Problem Analyzer: formula lookup tools, problem-type databases
  • Calculator Agent: unit conversion, statistical functions, graphing tools
  • Solution Presenter: diagram generation, readability checkers, LaTeX formatting

More specialized tools make each agent more capable within its domain, while keeping the overall pipeline structure clean and understandable.

Summary and Next Steps

You've now mastered the fundamentals of agentic pipelines by building specialized agents that work together in sequence. This pipeline pattern breaks complex problems into manageable pieces, makes systems easier to debug, and allows each agent to excel at its specific task.

In the upcoming practice exercises, you'll build your own agentic pipeline. The three-agent math pipeline you've learned here will serve as your foundation for creating much more sophisticated agentic systems!

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal