How to Start Development with Agentic Workflow

    A practical guide for developers stepping into agentic workflow development. Learn the core concepts, tooling, and step-by-step approach to building your first agentic system — from local setup to production-ready architecture.

    Tob

    Tob

    Backend Developer

    12 min readTutorials
    How to Start Development with Agentic Workflow

    TL;DR: Agentic workflow development is the discipline of building systems where AI models autonomously plan, execute, and iterate through multi-step tasks. If you're a developer looking to get started, this guide walks you through the core concepts, the right mental model, the tooling, and a hands-on path from zero to a working agentic workflow.

    ---

    What Is an "Agentic Workflow"?

    An agentic workflow is a structured sequence of tasks where an AI agent — rather than a human — drives the execution. The agent:

    1. Receives a goal (not a step-by-step instruction)
    2. Plans how to achieve it
    3. Calls tools to gather information or take action
    4. Observes the results
    5. Adjusts and continues until the goal is met

    This is different from traditional automation (which follows fixed rules) and different from a simple chatbot (which only responds). Agentic workflows are goal-driven and adaptive.

    A Quick Mental Model

    Think of an agentic workflow like hiring a junior developer on a task:

    • You give them a ticket: "Add email notifications when a user signs up."
    • They read the codebase, check existing patterns, write the code, run the tests, and open a PR.
    • They don't ask you about every line — they figure it out and come back with a result.

    An agentic workflow does exactly this, except the "junior developer" is an LLM with access to tools.

    ---

    Before You Write Any Code: The Right Mental Model

    Most developers stumble when they treat agentic workflows like regular API calls. Shift your thinking:

    Old mindsetAgentic mindset
    "Send prompt → get response""Give goal → agent figures out steps"
    One-shot executionLoop: plan → act → observe → repeat
    You control every stepAgent controls steps, you control constraints
    Errors are exceptionalErrors are expected; agents should recover
    Output is textOutput is a completed action or deliverable

    Get comfortable with non-determinism. Agentic systems don't always take the same path to the same answer. That's the point — they adapt.

    ---

    Choose Your Stack

    Before setting up anything, pick a stack that matches your language and use case. Here are the most practical options for getting started:

    For Python Developers

    FrameworkWhen to Use
    LangGraphWhen you need explicit control over agent state and transitions
    CrewAIWhen you want to build multi-agent teams quickly
    AutoGenWhen your workflow involves multiple agents talking to each other
    AgnoLightweight, production-focused single-agent workflows

    Recommended starter: LangGraph — it gives you the most visibility into what the agent is doing, which matters a lot when debugging.

    For TypeScript / Node.js Developers

    FrameworkWhen to Use
    Vercel AI SDKBuilding agents inside Next.js or Node.js backends
    MastraTypeScript-native agent graphs with built-in tool support
    LangChain.jsPort of LangChain for JS environments

    Recommended starter: Vercel AI SDK — excellent DX, great docs, plays well with Next.js.

    ---

    Set Up Your Environment

    Step 1: Get an LLM API Key

    Most agentic frameworks support multiple LLM providers. Start with one:

    • Anthropic Claude — Best reasoning for complex tasks, large context window
    • OpenAI GPT-4o — Broad tool support, large ecosystem
    • Google Gemini — Useful for multimodal tasks

    Create an account, generate an API key, and store it in a .env file. Never hardcode it.

    bash
    # .env
    ANTHROPIC_API_KEY=sk-ant-...
    # or
    OPENAI_API_KEY=sk-...

    Step 2: Install Your Framework

    bash
    # Python (using LangGraph)
    pip install langgraph langchain-anthropic python-dotenv
    
    # TypeScript (using Vercel AI SDK)
    npm install ai @ai-sdk/anthropic zod

    Step 3: Verify the Connection

    Before building anything agentic, confirm you can make a basic LLM call:

    python
    # Python
    from langchain_anthropic import ChatAnthropic
    from dotenv import load_dotenv
    
    load_dotenv()
    
    llm = ChatAnthropic(model="claude-3-5-sonnet-20241022")
    response = llm.invoke("Say hello in one sentence.")
    print(response.content)
    typescript
    // TypeScript
    import { generateText } from "ai";
    import { anthropic } from "@ai-sdk/anthropic";
    
    const { text } = await generateText({
      model: anthropic("claude-3-5-sonnet-20241022"),
      prompt: "Say hello in one sentence.",
    });
    console.log(text);

    If this works, you're ready to build agents.

    ---

    Build Your First Agentic Workflow

    Let's build a simple but real example: an agent that researches a topic and writes a summary.

    This agent needs to:

    1. Search the web for relevant information
    2. Extract key points
    3. Write a structured summary

    Define the Tools

    Tools are the agent's interface with the outside world. Each tool is a function with a clear name, description, and schema.

    python
    # Python example with LangGraph
    from langchain_core.tools import tool
    
    @tool
    def web_search(query: str) -> str:
        """Search the web for information about a topic. Returns a list of relevant snippets."""
        # In production, use Tavily, Serper, or Brave Search API
        # For now, simulate a response
        return f"Search results for '{query}': [result 1, result 2, result 3]"
    
    @tool
    def write_file(filename: str, content: str) -> str:
        """Write content to a file. Use for saving the final summary."""
        with open(filename, "w") as f:
            f.write(content)
        return f"File '{filename}' written successfully."
    typescript
    // TypeScript example with Vercel AI SDK
    import { tool } from "ai";
    import { z } from "zod";
    
    const webSearch = tool({
      description: "Search the web for information about a topic.",
      parameters: z.object({
        query: z.string().describe("The search query"),
      }),
      execute: async ({ query }) => {
        // Replace with real search API call
        return `Search results for "${query}": [result 1, result 2, result 3]`;
      },
    });

    Define the Agent

    The agent is the LLM + tools + system prompt. The system prompt tells the agent who it is and how to behave.

    python
    # Python - LangGraph agent
    from langgraph.prebuilt import create_react_agent
    
    tools = [web_search, write_file]
    
    agent = create_react_agent(
        model=llm,
        tools=tools,
        state_modifier="""You are a research assistant. When given a topic:
    1. Search for relevant information using the web_search tool
    2. Identify the 3-5 most important points
    3. Write a clear, concise summary and save it using write_file
    Always cite where your information came from."""
    )
    typescript
    // TypeScript - Vercel AI SDK agent loop
    import { generateText } from "ai";
    
    async function runAgent(goal: string) {
      const messages = [{ role: "user" as const, content: goal }];
    
      while (true) {
        const result = await generateText({
          model: anthropic("claude-3-5-sonnet-20241022"),
          system: `You are a research assistant. Search for information and write a structured summary.`,
          messages,
          tools: { webSearch },
          maxSteps: 10, // Hard cap — always set this
        });
    
        if (result.finishReason === "stop") {
          return result.text;
        }
    
        // Add tool results back to messages and continue
        messages.push(...result.responseMessages);
      }
    }

    Run the Agent

    python
    # Python
    result = agent.invoke({
        "messages": [("user", "Research the current state of agentic AI in 2026 and write a summary to summary.md")]
    })
    print(result["messages"][-1].content)
    typescript
    // TypeScript
    const output = await runAgent(
      "Research the current state of agentic AI in 2026 and write a 3-paragraph summary."
    );
    console.log(output);

    When you run this, you'll see the agent:

    • Decide to call web_search
    • Process the results
    • Maybe call web_search again for a follow-up
    • Draft the summary
    • Call write_file to save it
    • Report completion

    That's an agentic workflow.

    ---

    The Five Things That Will Break Your Agent

    Once the basics work, you'll hit these issues. Know them ahead of time:

    1. No Step Limit

    Without a maxSteps (or equivalent), an agent can loop indefinitely — burning your API budget. Always set a hard cap.

    python
    # LangGraph
    agent = create_react_agent(..., checkpointer=MemorySaver())
    config = {"recursion_limit": 25}  # Max steps

    2. Vague System Prompts

    "Be helpful" is not a system prompt. Agents need explicit instructions:

    • What tools to use and when
    • What format the output should be in
    • What to do when stuck or when a tool fails
    • What constitutes task completion

    3. No Error Handling in Tools

    If your tool raises an exception, the agent gets a confusing error message and often hallucinates a recovery. Wrap tool logic in try/except and return structured error messages the agent can understand.

    python
    @tool
    def web_search(query: str) -> str:
        """Search the web."""
        try:
            result = search_api.query(query)
            return result.text
        except Exception as e:
            return f"Search failed: {str(e)}. Try a different query."

    4. No Logging

    Agents are opaque by default. Add logging to every tool call so you can debug what happened when things go wrong.

    python
    import logging
    logging.basicConfig(level=logging.INFO)
    
    @tool
    def web_search(query: str) -> str:
        """Search the web."""
        logging.info(f"[web_search] query={query!r}")
        result = search_api.query(query)
        logging.info(f"[web_search] result_length={len(result.text)}")
        return result.text

    5. Missing Input Validation

    LLMs sometimes call tools with wrong argument types or missing values. Use schema validation (Pydantic in Python, Zod in TypeScript) to catch these at the tool boundary.

    ---

    Structuring a Production Agentic Workflow

    Once your prototype works, here's how to harden it for real use:

    Use a State Machine, Not a Loop

    In production, an agent workflow is best modeled as a state machine where each state corresponds to a phase of the task:

    text
    [START] → [planning] → [researching] → [drafting] → [reviewing] → [done]
                                  ↑_______________|

    LangGraph is built around this model. Explicit states make debugging and observability dramatically easier.

    Add Checkpoints

    For long-running workflows, save state at each step so you can resume from a checkpoint if something fails — instead of starting over.

    python
    from langgraph.checkpoint.memory import MemorySaver
    
    checkpointer = MemorySaver()
    agent = create_react_agent(model=llm, tools=tools, checkpointer=checkpointer)
    
    config = {"configurable": {"thread_id": "task-42"}}
    result = agent.invoke({"messages": [...]}, config=config)

    Monitor Cost Per Task

    Every agentic workflow burns tokens. Track usage:

    python
    result = agent.invoke({"messages": [...]})
    
    # LangGraph exposes token usage in metadata
    usage = result.get("__metadata__", {}).get("usage", {})
    print(f"Input tokens: {usage.get('input_tokens', 0)}")
    print(f"Output tokens: {usage.get('output_tokens', 0)}")

    Set budget alerts so a runaway agent doesn't rack up a $500 API bill overnight.

    ---

    A Practical Learning Path

    If you're starting from zero today, here's the progression that works:

    Week 1 — Foundation

    • Complete one LangGraph or Vercel AI SDK tutorial end-to-end
    • Build a single-tool agent (just web search or just file writing)
    • Read the ReAct paper — it's short and it's the foundation for every agent loop

    Week 2 — Multi-Tool Agent

    • Build an agent with 3+ tools
    • Add structured logging to every tool call
    • Intentionally break the agent and debug using the logs

    Week 3 — Reliability

    • Add Pydantic/Zod validation to all tool schemas
    • Implement retry logic for tool failures
    • Set max_steps and handle the case where the agent hits the limit gracefully

    Week 4 — Production Patterns

    • Add human-in-the-loop gates for irreversible actions
    • Store agent state in a database (not just in-memory)
    • Write at least 3 automated tests for your agent's behavior on known inputs

    Month 2 — Advanced

    • Explore multi-agent orchestration (one orchestrator, multiple specialized sub-agents)
    • Implement context summarization for long-running agents
    • Study prompt injection attack patterns and how to mitigate them

    ---

    Tools Worth Knowing

    Beyond frameworks, these services make agentic development easier:

    ToolWhat It Does
    TavilySearch API designed for LLM agents — clean, structured results
    LangSmithTracing, debugging, and evaluation for LangChain/LangGraph agents
    HeliconeLLM observability — cost tracking, logging, rate limiting
    E2BSandboxed code execution environments for coding agents
    ComposioPre-built tool integrations (GitHub, Slack, Gmail, 100+ others)

    Start with Tavily for search and LangSmith (or an equivalent tracer) for observability. These two alone will save you hours of debugging.

    ---

    Common Mistakes to Avoid

    Don't give the agent too many tools. 5-7 well-designed tools outperform 20 mediocre ones. Each tool should do exactly one thing, clearly.

    Don't skip the system prompt. Agents without clear behavioral instructions drift, hallucinate, and waste tokens.

    Don't ignore tool output structure. Return consistent, parseable output from tools — not free-form text. The agent needs to extract information reliably.

    Don't test only the happy path. What happens when the search API is down? When the agent hits the step limit? When the LLM returns malformed tool arguments? Test these explicitly.

    Don't deploy without observability. If you can't see what the agent is doing, you can't fix it when it breaks.

    ---

    Summary

    Getting started with agentic workflow development comes down to a few core moves:

    1. Adopt the right mental model — goal-driven, adaptive, multi-step
    2. Pick a framework — LangGraph for Python, Vercel AI SDK for TypeScript
    3. Start with a minimal agent — one goal, two or three tools, a clear system prompt
    4. Add guardrails early — step limits, logging, input validation
    5. Iterate on reliability — checkpoints, error handling, cost monitoring
    6. Progress toward multi-agent systems only after your single-agent workflow is solid

    The bar for a working prototype is lower than you think. The bar for a reliable agentic system is higher than most tutorials show. This guide bridges that gap.

    Start small. Ship something that works. Then harden it.

    ---

    Questions about getting started? Follow along as we continue to explore agentic AI engineering in depth.

    Related Blog

    How to Start Development with Agentic Workflow | Tob