Security advisory — Malicious litellm versions 1.82.7 and 1.82.8 were removed from PyPI (potential API key exfiltration). Uninstall them, rotate exposed credentials, and upgrade to a safe release (e.g. 1.82.9+ per upstream). Run pip show litellm to verify. PyPI · README

Building Your First Agent

Step-by-step guide to building a research agent.

Building Your First Agent

This guide walks through building a real-world research agent step by step.

What We're Building

A research agent that:

  1. Accepts a research topic
  2. Searches the web for information
  3. Synthesizes findings into a structured report

Step 1: Set Up

bash
1pip install agenticx
2export OPENAI_API_KEY="your-key"

Step 2: Define Your Tools

python
1# tools.py
2from agenticx.tools import tool
3import httpx
4
5@tool
6def search_web(query: str) -> str:
7 """Search the web for information about a topic.
8
9 Args:
10 query: The search query
11
12 Returns:
13 Search results as text
14 """
15 # Replace with your preferred search API
16 response = httpx.get(
17 "https://api.search.com/search",
18 params={"q": query, "key": "your-api-key"}
19 )
20 return response.text
21
22@tool
23def fetch_page(url: str) -> str:
24 """Fetch the content of a web page.
25
26 Args:
27 url: The URL to fetch
28
29 Returns:
30 Page content as text
31 """
32 response = httpx.get(url, follow_redirects=True)
33 return response.text[:5000] # First 5000 chars

Step 3: Define the Agent

python
1# agent.py
2from agenticx import Agent
3
4research_agent = Agent(
5 id="research-agent",
6 name="Research Assistant",
7 role="Senior Research Analyst",
8 goal=(
9 "Conduct thorough research on any given topic. "
10 "Find authoritative sources, synthesize information, "
11 "and produce clear, well-structured reports."
12 ),
13 backstory=(
14 "You are an expert researcher with a background in "
15 "information synthesis and critical analysis."
16 ),
17 organization_id="my-research-org",
18 max_iter=15,
19 verbose=True
20)

Step 4: Create and Run a Task

python
1# main.py
2from agenticx import Task, AgentExecutor
3from agenticx.llms import OpenAIProvider
4from tools import search_web, fetch_page
5from agent import research_agent
6
7def research(topic: str) -> str:
8 task = Task(
9 id="research-task",
10 description=f"Research: {topic}",
11 expected_output=(
12 "A structured research report with:\n"
13 "1. Executive summary\n"
14 "2. Key findings\n"
15 "3. Detailed analysis\n"
16 "4. Sources and references"
17 )
18 )
19
20 llm = OpenAIProvider(model="gpt-4o")
21 executor = AgentExecutor(
22 agent=research_agent,
23 llm=llm,
24 tools=[search_web, fetch_page]
25 )
26
27 return executor.run(task)
28
29if __name__ == "__main__":
30 result = research("Multi-agent AI systems impact on software development")
31 print(result)

Step 5: Run It

bash
1python main.py

Enhancements

Add Memory

python
1from agenticx.memory import MemoryManager
2
3memory = MemoryManager()
4executor = AgentExecutor(agent=research_agent, llm=llm, tools=[...], memory=memory)

Add Observability

python
1from agenticx.observability import ConsoleTracer
2
3tracer = ConsoleTracer()
4executor = AgentExecutor(agent=research_agent, llm=llm, tools=[...], tracer=tracer)

Use the CLI

bash
1agx project create research-bot --template basic
2cd research-bot
3agx run agent.py --verbose

Next Steps