AI Agent Frameworks: LangGraph, CrewAI, Agno

Frameworks for building agents — from simple single-agent to multi-agent teams with local models via Ollama.

🇷🇺 Russian version: frameworks.ru.md


← AI agents · Patterns · Ollama for agents →


Contents

  1. Comparison table
  2. Agno — quick start
  3. CrewAI — agent team
  4. LangGraph — maximum control
  5. Other frameworks
  6. How to choose
  7. What’s next

1. Comparison table

Framework Level Multi-agent Ollama When to use
Agno 15K+ Beginner Team Quick prototype, first agent
CrewAI 25K+ Intermediate Crew Agent team with roles
LangGraph 10K+ Advanced Graphs Maximum control
OpenAI Agents SDK — Beginner Handoff If you know OpenAI API
AutoGen 48K+ Intermediate GroupChat Multi-agent dialogues
Mastra 10K+ Intermediate Yes TypeScript projects

All examples below use Ollama with qwen3.5:4b. Make sure Ollama is running (ollama serve).


2. Agno — quick start

pip install agno
from agno.agent import Agent
from agno.models.ollama import Ollama
from agno.tools.duckduckgo import DuckDuckGoTools

agent = Agent(
    model=Ollama(id="qwen3.5:4b"),
    tools=[DuckDuckGoTools()],
    description="You are a helpful assistant with internet access",
    markdown=True
)

agent.run("What are the trends in AI agents in 2026?")

Agent with custom tools

def get_server_status(host: str) -> str:
    """Check server status"""
    import subprocess
    result = subprocess.run(["ping", "-c", "1", host], capture_output=True, text=True)
    return "available" if result.returncode == 0 else "unavailable"
    tools=[get_server_status],
    show_tool_calls=True  # 👈 see which tools are being called
)

agent.run("Check the status of google.com")

Team of two agents

from agno.agent import Agent
from agno.models.ollama import Ollama
from agno.team import Team

researcher = Agent(
    name="Researcher",
    model=Ollama(id="qwen3.5:4b"),
    instructions="Find information and pass it to the editor",
)

writer = Agent(
    name="Editor",
    model=Ollama(id="qwen3.5:4b"),
    instructions="Write a brief report based on the data received",
)

team = Team(
    name="Content team",
    members=[researcher, writer],
    model=Ollama(id="qwen3.5:4b"),
    instructions="Coordinate the team's work to create content",
)

team.run("Write a brief overview of the latest AI news")

When Agno:


3. CrewAI — agent team

CrewAI is built around roles: each agent has a role, goal, and backstory. Agents join a Crew and execute Tasks.

pip install crewai
from crewai import Agent, Task, Crew, Process, LLM

# 1. Create LLM with Ollama
llm = LLM(
    model="ollama/qwen3.5:4b",
    base_url="http://localhost:11434"
)

# 2. Agents with roles
researcher = Agent(
    role="Market researcher",
    goal="Find current data on AI trends",
    backstory="Experienced analyst with 10 years of experience",
    llm=llm,
    allow_delegation=False
)

writer = Agent(
    role="Technical writer",
    goal="Create a clear report based on the data",
    backstory="Writes documentation for complex technologies",
    llm=llm,
)

# 3. Tasks
research_task = Task(
    description="Find 5 key trends in AI agents in 2026",
    agent=researcher,
    expected_output="A list of 5 trends with brief descriptions"
)

write_task = Task(
    description="Based on the trends, write a brief report (3 paragraphs)",
    agent=writer,
    expected_output="Report text in markdown"
)

# 4. Create the crew
crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, write_task],
    process=Process.sequential,
    verbose=True
)

result = crew.kickoff()
print(result)

When CrewAI:

    process=Process.hierarchical,  # 👈 manager delegates
    manager_llm=llm,
)

With Process.hierarchical the manager decides who gets which task and in what order.


4. LangGraph — maximum control

LangGraph gives you full control over the agent’s transition graph. You describe nodes (what the agent does) and edges (when to transition).

pip install langgraph langchain-ollama
from typing import TypedDict, Annotated
from langgraph.graph import StateGraph, START, END
from langgraph.graph.message import add_messages
from langgraph.prebuilt import ToolNode, tools_condition
from langchain_ollama import ChatOllama
from langchain_core.tools import tool

# 1. Agent state
class AgentState(TypedDict):
    messages: Annotated[list, add_messages]

# 2. Tools
@tool
def search_web(query: str) -> str:
    """Search for information on the web"""
    return f"Search results for: {query}"

# 3. Model
llm = ChatOllama(model="qwen3.5:4b", base_url="http://localhost:11434")
llm_with_tools = llm.bind_tools(tools)

# 4. Agent node
def agent_node(state: AgentState):
    return {"messages": [llm_with_tools.invoke(state["messages"])]}

# 5. Build graph
graph = StateGraph(AgentState)
graph.add_node("agent", agent_node)
graph.add_node("tools", ToolNode(tools))
graph.add_edge(START, "agent")
graph.add_conditional_edges("agent", tools_condition, {"tools": "tools", END: END})
graph.add_edge("tools", "agent")

# 6. Compile
agent = graph.compile()

# 7. Run
result = agent.invoke({
    "messages": [("user", "What's new in AI in 2026?")]
})
print(result["messages"][-1].content)

Multi-agent with Supervisor (LangGraph)

from langgraph.graph import StateGraph, START, END, MessagesState
from langchain_ollama import ChatOllama

llm = ChatOllama(model="qwen3.5:4b", base_url="http://localhost:11434")

# Researcher agent
def researcher(state: MessagesState):
    response = llm.invoke([
        {"role": "system", "content": "You are a researcher. Find facts and data."},
        *state["messages"]
    ])
    return {"messages": [response]}

# Writer agent
def writer(state: MessagesState):
    response = llm.invoke([
        {"role": "system", "content": "You are a writer. Create texts based on facts."},
        *state["messages"]
    ])
    return {"messages": [response]}

# Supervisor — decides who goes next
def supervisor(state: MessagesState):
    response = llm.invoke([
        {"role": "system", "content": (
            "You are a supervisor. Choose who will work next: "
            "'researcher' to find data, 'writer' to write text, "
            "'FINISH' if the task is complete."
        )},
        *state["messages"]
    ])
    return {"messages": [response]}

# Build graph
graph = StateGraph(MessagesState)
graph.add_node("supervisor", supervisor)
graph.add_node("researcher", researcher)
graph.add_node("writer", writer)

graph.add_edge(START, "supervisor")
graph.add_conditional_edges("supervisor", lambda s: s["messages"][-1].content)
graph.add_edge("researcher", "supervisor")
graph.add_edge("writer", "supervisor")

When LangGraph:


5. Other frameworks

OpenAI Agents SDK

from agents import Agent, Runner, function_tool

@function_tool
def get_weather(city: str) -> str:
    return f"Weather in {city}: +22°C"

agent = Agent(
    name="Weather assistant",
    instructions="Help with weather forecasts",
    tools=[get_weather],
    model="qwen3.5:4b"  # via Ollama with proxy
)

Works if you already know the OpenAI API. Use forge as a proxy for local models.

Mastra

const agent = new Agent({
  name: 'my-agent',
  model: {
    provider: 'OLLAMA',
    name: 'qwen3.5:4b',
  },
  instructions: 'You are a helpful assistant',
});

For TypeScript projects. Good Ollama integration.

AutoGen

# pip install pyautogen
from autogen import AssistantAgent, UserProxyAgent

llm_config = {
    "config_list": [{
        "model": "qwen3.5:4b",
        "base_url": "http://localhost:11434/v1",
        "api_type": "openai",
        "api_key": "ollama"
    }]
}

agent = AssistantAgent("assistant", llm_config=llm_config)
user = UserProxyAgent("user", code_execution_config=False)
user.initiate_chat(agent, message="Analyze AI trends in 2026")

6. How to choose

Beginner, first agent
  → Agno (5 lines of code, everything clear)

Need agent team with roles
  → CrewAI (roles, tasks, processes)

Maximum control over logic
  → LangGraph (graphs, state, cycles)

Know OpenAI API, want local
  → OpenAI Agents SDK + forge proxy

Write in TypeScript
  → Mastra

Multi-agent dialogues
  → AutoGen (GroupChat)

For your project (agent team)

CrewAI (Process.hierarchical)
  → PM agent
    → Analyst
    → Developer
    → Tester
    → DevOps

Each agent is a CrewAI role. Manager distributes tasks. More details in the 02-agent-team tutorial.


7. What’s next

| If you want | Go to | |————-|——-| | Write your first agent without frameworks | tutorials/01-first-agent.md | | Build an agent team (your scenario) | tutorials/02-agent-team.md | | Connect Ollama to any framework | ollama-for-agents.md | | Understand agent architecture | architecture.md | | Back to navigation | README.md | —


In section: architecture · evaluation · frameworks · memory · multi-agent · ollama-for-agents · orchestrators · patterns · prompting · ready-made · safety · skills
Related sections: Zero Level · Local Models · Use Cases · Resources
Navigation: ← AI Agents · ↑ Back to main · 🇷🇺 Русский