Example: Agent research
A research platform with autonomous agents. It shows jangada's four
orchestration shapes side by side: single agent, team (Squad),
planning (plan) and failover (with_fallback) — plus integration with
remote MCP servers.
Folder: pocs/pesquisa-agentes · Suggested port: 8004
jangada features
Agent— autonomous agent with a tool loopSquad— team of agents with sequential handoffplan()— decomposes a goal into taskswith_fallback()— automatic failover between providersMCPClient+run_agent()— an agent over a remote MCP server's tools
Core of the example
Single agent (app/routers/pesquisa.py):
from jangada_ai import Agent
from jangada_ai.prebuilt import calculator, current_datetime, wikipedia_search
agent = Agent(
llm, role="Researcher", goal="answer accurately using the tools",
tools=[wikipedia_search, calculator, current_datetime],
)
res = agent.run(req.tarefa)Team with handoff:
from jangada_ai import Squad
researcher = Agent(llm, role="Researcher", goal="gather facts and sources", tools=[wikipedia_search])
analyst = Agent(llm, role="Analyst", goal="organize the findings into topics")
writer = Agent(llm, role="Writer", goal="write a clear, concise briefing")
res = Squad([researcher, analyst, writer]).run(req.tarefa)Provider failover:
llm = primary.with_fallback(backup) # falls to backup on 429/5xx/timeout
comp = await llm.acomplete(req.prompt)
print(comp.provider, comp.model) # who actually answeredAgent over remote MCP (app/routers/mcp.py):
from jangada_ai import MCPClient, run_agent
async with MCPClient(url, headers={"Authorization": f"Bearer {token}"}) as mcp:
ans = await run_agent(llm, req.tarefa, client=mcp)Things to watch
- Prefer a sequential
Squadwhen roles are clear (research → analyze → write); it's more predictable than one long single agent. with_fallbackfails over before the first token — it won't switch providers mid-response.
How to run
cd pocs/pesquisa-agentes
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8004 # http://localhost:8004/docsSee Agents, Retry and fallback and MCP.
Example: Fiscal Vision
Reads invoices and receipts from photos: extracts structured data via vision, detects regions, and checks the item sum with tools.
Example: Meeting assistant
Takes meeting audio/video and returns a transcript, structured minutes (decisions and actions) via Flow, and a streaming executive summary.