Unlike traditional systems that follow predefined paths, AI agents are autonomous systems that use large linguistic models (LLMs) to make decisions, adapt to changes in requirements, and perform complex inferences.
In this guide to self-paced workshops to build report generation agents, you will get:
- Understanding four core considerations for AI agents, including Nvidia Nemotron, an open model family with open data and weights.
- A work document generation agent that allows you to research and create reports.
- Knowledge of how to build agents using Langgraph and OpenRouter.
- Turnkey, portable development environment.
- Your own customized agent is ready to be shared as NVIDIA bootable.
Workshop development
Start the workshop as a Nvidia Brev Launchable:
![[今すぐ展開]Button image](https://developer-blogs.nvidia.com/wp-content/uploads/2025/09/Figure-2.-Button-to-deploy-the-NVIDIA-DevX-Workshop-in-the-cloud-with-NVIDIA-Brev-1-png-1.webp)
![[今すぐ展開]Button image](https://developer-blogs.nvidia.com/wp-content/uploads/2025/09/Figure-2.-Button-to-deploy-the-NVIDIA-DevX-Workshop-in-the-cloud-with-NVIDIA-Brev-1-png-1.webp)
Configuring secrets
To follow this workshop, you will need to gather and configure the secrets of several projects.
- OpenRouter API Key: This allows access to the Nvidia Nemotron Nano 9B V2 model via OpenRouter.
- Tavily API Key: This allows access to the Tavily Web Search API for real-time web search.
It can be used when the JupyterLab environment is running Secret Manager Tile Under nvidia devx learning path With the JupyterLab launcher, configure these secrets in your workshop development environment.[ログ]In the tab, confirm that the secret was successfully added.


Next, find nvidia devx learning path JupyterLab launcher section. Select 1. Introducing the Agent Tiles to open and start lab instructions.


Introducing the Agent Architecture
Once the workshop environment is set up, the first section introduces the agent to the developer. Before diving into implementation, it is important to understand what distinguishes agents from simpler AI applications.
Unlike traditional LLM-based applications, agents can dynamically select tools, incorporate complex inferences, and adapt their analytical approaches based on the situation at hand. Developers will learn about four important basic considerations for every agent:
- Model: Determine the LLM that functions as a brain, the tools to use and how to respond.
- tool: A function that allows LLM to perform actions such as mathematical calculations, database queries, and API calls.
- Memory and state: Information available to LLM during and between conversations.
- routing: The logic that determines what the agent should do next, based on the current state and LLM decisions.
Together these components, learn how to build your first basic computer-equipped agent code/intro_to_agents.ipynb. By the end of this exercise, you will have an agent to complete the following:
[{'content': 'What is 3 plus 12?', 'role': 'user'},
{'content': None,
'role': 'assistant',
'tool_calls': [{'function': {'arguments': '{"a": 3, "b": 12}', 'name': 'add'},
'id': 'chatcmpl-tool-b852128b6bdf4ee29121b88490174799',
'type': 'function'}]},
{'content': '15',
'name': 'add',
'role': 'tool',
'tool_call_id': 'chatcmpl-tool-b852128b6bdf4ee29121b88490174799'},
{'content': 'The answer is 15.', 'role': 'assistant'}]
Report Generation Component
The rest of this workshop focuses on building multi-tier agent systems. Langgraph and Nvidia Nim was hosted as an OpenRouter endpoint. The architecture consists of four interconnected agent components that handle each specific aspect of the document generation process.
- First study: Collect comprehensive information about topics.
- Outline Planning: Create a research-based, structured document overview.
- Section writing: Generate detailed content for each section using additional research as needed.
- Final Edit: Assemble all sections into professional reports.
Learn and implement the code
Now that you understand the concept, let's dive into technical implementation. Starting with the basic considerations above, stack them up into a complete agent.
- Select a model
- Select a tool
- Building researchers
- Build the author
- Build the final agent
- Manage and route agents
Basics: Model
Workshops depend on nvidia nim The endpoint of the core model that powers the agent. Nvidia Nim offers high performance inference features including:
- Tool Binding: Native support for function call.
- Structured output: Embedded support for Pydantic models.
- Asynchronous operations: Full Async/awaint compurent processing support.
- Enterprise reliability: Production grade inference infrastructure.
This example shows a Chatnvidia connector using Nvidia NIM hosted as an OpenRouter endpoint.
from langchain_nvidia_ai_endpoints import ChatNVIDIA
llm = ChatNVIDIA(
base_url="https://openrouter.ai/api/v1",
model="nvidia/nemotron-nano-9b-v2:free",
api_key=os.getenv("OPENROUTER_API_KEY")
)
llm_with_tools = llm.bind_tools([tools.search_tavily])
Clear quality instructions are important in LLM-based applications, but they are especially important for agents as they remove ambiguity and clarify the decision-making process. One such example code/docgen_agent/prompts.py It is provided as follows:
research_prompt: Final[str] = """
Your goal is to generate targeted web search queries that will gather comprehensive information for writing a technical report section.
Topic for this section:
{topic}
When generating {number_of_queries} search queries, ensure they:
1. Cover different aspects of the topic (e.g., core features, real-world applications, technical architecture)
2. Include specific technical terms related to the topic
3. Target recent information by including year markers where relevant (e.g., "2024")
4. Look for comparisons or differentiators from similar technologies/approaches
5. Search for both official documentation and practical implementation examples
Your queries should be:
- Specific enough to avoid generic results
- Technical enough to capture detailed implementation information
- Diverse enough to cover all aspects of the section plan
- Focused on authoritative sources (documentation, technical blogs, academic papers)"""
This prompt illustrate some important principles of a reliable LLM prompt.
- Role Specifications: A clear definition of agent expertise and responsibility.
- Task decomposition: Decompose complex requirements into specific practical steps or criteria.
- Specificity: References Examples of temporal specificity and authoritative sources.
- Structured Input/Output: Specific instructions for the desired response structure and the expected input structure.
Basics: Tools
Agent functionality is defined through the tool. The workshop uses Tavily, a search API specifically designed for AI agents, as its primary tool for information gathering.
# imports and constants omitted
@tool(parse_docstring=True)
async def search_tavily(
queries: list[str],
topic: Literal["general", "news", "finance"] = "news",
) -> str:
"""Search the web using the Tavily API.
Args:
queries: List of queries to search.
topic: The topic of the provided queries.
general - General search.
news - News search.
finance - Finance search.
Returns:
A string of the search results.
"""
search_jobs = []
for query in queries:
search_jobs.append(
asyncio.create_task(
tavily_client.search(
query,
max_results=MAX_RESULTS,
include_raw_content=INCLUDE_RAW_CONTENT,
topic=topic,
days=days, # type: ignore[arg-type]
)
)
)
search_docs = await asyncio.gather(*search_jobs)
return _deduplicate_and_format_sources(
search_docs,
max_tokens_per_source=MAX_TOKENS_PER_SOURCE,
include_raw_content=INCLUDE_RAW_CONTENT,
)
Determining key architectures in implementing tool modules includes:
- Asynchronous operations: Use `asyncio.gather()`
- Deduplication: Helper function to prevent redundancy from multiple searches
- Structured Documentation: Google Style Docstrings help LLM understand the use of tools
Now that you have established a basic understanding of the models and tools in your code, let's assemble them into a real work agent. We haven't yet looked into state management and routing considerations, but once we've built the agent components, we'll review them later.
Researcher implementation
The agent's researcher component implements patterns of inference and behavior (reaction)One of the most effective architectures for tool use agents. This pattern creates a loop that considers what the agent should do, performs actions, and determines the next step based on the outcome. This continues until the agent evaluates that no further action is required to complete the task.


The code for this researcher component of the agent is implemented in code/docgen_agent/researcher.py And can be tested by code/researcher_client.ipynb.
state = ResearcherState(
topic="Examples of AI agents in various industries.",
number_of_queries=3,
)
state = await graph.ainvoke(state)
for message in state["messages"]:
print("ROLE: ", getattr(message, "role", "tool_call"))
print(message.content[:500] or message.additional_kwargs)
print("")
You can also see each action the researcher has taken during the execution.
INFO:docgen_agent.researcher:Calling model.
INFO:docgen_agent.researcher:Executing tool calls.
INFO:docgen_agent.researcher:Executing tool call: search_tavily
INFO:docgen_agent.tools:Searching the web using the Tavily API
INFO:docgen_agent.tools:Searching for query: Technical architecture of AI agents in healthcare 2024
INFO:docgen_agent.tools:Searching for query: Comparison of machine learning frameworks for AI agents in finance
INFO:docgen_agent.tools:Searching for query: Real-world applications of natural language processing in AI agents for customer service 2024
INFO:httpx:HTTP Request: POST https://api.tavily.com/search "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://api.tavily.com/search "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://api.tavily.com/search "HTTP/1.1 200 OK"
INFO:docgen_agent.researcher:Calling model.
It also includes final output, such as tool call requests, tool output, and final message summarizing the results.
ROLE: assistant
{'tool_calls': [{'id': 'chatcmpl-tool-b7185ba8eb3a44259b0bdf930495ece5', 'type': 'function', 'function': {'name': 'search_tavily', 'arguments': '{"queries": ["Technical architecture of AI agents in healthcare 2024", "Comparison of machine learning frameworks for AI agents in finance", "Real-world applications of natural language processing in AI agents for customer service 2024"], "topic": "general"}'}}]}
ROLE: tool_call
"Sources:\n\nSource AI Agents in Modern Healthcare: From Foundation to Pioneer:\n===\nURL: https://www.preprints.org/manuscript/202503.1352/v1\n===\nMost relevant content from source: T. Guo et al., \"Large language model based multi-agents: A survey of progress and challenges,\" arXiv preprint arXiv:2402.01680, 2024. J. Ruan et al., \"TPTU: Large Language Model-based AI Agents for Task Planning and Tool Usage. | **Partner Agent** | * True healthcare team partners * Generates clinical hypotheses
ROLE: assistant
Based on the search results, here are some potential search queries that could be used to gather comprehensive information for writing a technical report section on examples of AI agents in various industries:
1. "Technical architecture of AI agents in healthcare 2024"
2. "Comparison of machine learning frameworks for AI agents in finance"
3. "Real-world applications of natural language processing in AI agents for customer service 2024"
Author Implementation
Simple reactants are very powerful, but often combined with additional steps to make more complex workflows. Section authors should perform additional section-related studies, but only if requested. Once the required research is available, you should write a section using that study.
The revised architectural diagram adds gating functionality before React-style agents, whether additional research is required, and a writing step is required at the end.


The code for this researcher component of the agent is implemented in code/docgen_agent/author.py And can be tested by code/author_client.ipynb.
state = SectionWriterState(
index=1,
topic="Examples of AI agents in various industries.",
section=Section(
name="Real-World Applications",
description="Examples of AI agents in various industries",
research=True,
content=""
),
)
state = await graph.ainvoke(state)
Markdown(state["section"].content)
You can also see each action the author has taken during execution.
INFO:docgen_agent.author:Researching section: Real-World Applications
INFO:docgen_agent.author:Executing tool calls for section: Real-World Applications
INFO:docgen_agent.author:Executing tool call: search_tavily
INFO:docgen_agent.tools:Searching the web using the Tavily API
INFO:docgen_agent.tools:Searching for query: AI agents in healthcare industry 2024
INFO:docgen_agent.tools:Searching for query: Implementation of AI agents in finance sector 2023
...
INFO:httpx:HTTP Request: POST https://api.tavily.com/search "HTTP/1.1 200 OK"
INFO:docgen_agent.author:Researching section: Real-World Applications
INFO:docgen_agent.author:Writing section: Real-World Applications
Like the final output, it consists of written sections in markdown format.
## Real-World Applications
AI agents have numerous applications across various industries...
### Healthcare
AI agents in healthcare are revolutionizing patient care and medical innovation. They are being used to automate administrative tasks, enhance diagnostics, and improve workflow efficiency. For instance...
### Finance
AI agents in finance are driving innovation, success, and compliance. They are being used to automate tasks such as data entry, transaction processing, and compliance checks. AI agents are also being used to detect fraud, improve customer service, and provide personalized investment advice. For example...
Implementing the final agent
These two components can be used to organize the workflow of the Document Generation Agent. This architecture is the simplest thing ever. This is a linear workflow that explores topics, writes sections, and sums up the entire complete report.


The code for this researcher component of the agent is implemented in code/docgen_agent/agent.py And can be tested by code/agent_client.ipynb.
state = AgentState(
topic="The latest developments with AI Agents in 2025.",
report_structure="This article should be..."
)
state = await graph.ainvoke(state)
Markdown(state["report"])
You can also see each action the author has taken during execution.
INFO:docgen_agent.agent:Performing initial topic research.
INFO:docgen_agent.researcher:Calling model.
INFO:docgen_agent.researcher:Executing tool calls.
INFO:docgen_agent.researcher:Executing tool call: search_tavily
INFO:docgen_agent.tools:Searching the web using the Tavily API
INFO:docgen_agent.tools:Searching for query: AI Agents 2025 core features
INFO:docgen_agent.tools:Searching for query: Real-world applications of AI Agents in 2025
...
INFO:httpx:HTTP Request: POST https://api.tavily.com/search "HTTP/1.1 200 OK"
INFO:docgen_agent.researcher:Calling model.
INFO:docgen_agent.agent:Calling report planner.
INFO:docgen_agent.agent:Orchestrating the section authoring process.
INFO:docgen_agent.agent:Creating author agent for section: Introduction
INFO:docgen_agent.agent:Creating author agent for section: Autonomous Decision-Making
INFO:docgen_agent.agent:Creating author agent for section: Integration with Physical World
INFO:docgen_agent.agent:Creating author agent for section: Agentic AI Trends
INFO:docgen_agent.agent:Creating author agent for section: AI Agents in Customer Support
INFO:docgen_agent.agent:Creating author agent for section: AI Agents in Healthcare
INFO:docgen_agent.agent:Creating author agent for section: Conclusion
INFO:docgen_agent.agent:Throttling LLM calls.
INFO:docgen_agent.author:Writing section: Introduction
INFO:docgen_agent.author:Researching section: Autonomous Decision-Making
...
The final report is generated in Markdown format. Provided is a sample survey report: Sample Markdown output generated by this agent.
Fundamentals: State Management and Routing
With your agent components built, take a step back and explore how to use them Langgraph Connect all three components to a single agent AI system as an agent framework for advanced state management and flow control. Langgraph offers several important benefits:
- Conditional RoutingConditional edges allow dynamic flow control based on runtime conditions, allowing agents to make intelligent decisions about the next action.
- Graph compilation and execution: Compiled graphs are invoked asynchronously and can support concurrent and complex orchestration patterns essential to multi-agent systems.
In the example from code/docgen_agent/agent.py A previously built component can be seen to which node it corresponds, as well as the edges that connect or route intermediate outputs from one node to the next.
main_workflow = StateGraph(AgentState)
main_workflow.add_node("topic_research", topic_research)
main_workflow.add_node("report_planner", report_planner)
main_workflow.add_node("section_author_orchestrator", section_author_orchestrator)
main_workflow.add_node("report_author", report_author)
main_workflow.add_edge(START, "topic_research")
main_workflow.add_edge("topic_research", "report_planner")
main_workflow.add_edge("report_planner", "section_author_orchestrator")
main_workflow.add_edge("section_author_orchestrator", "report_author")
main_workflow.add_edge("report_author", END)
Congratulations! Walking through each step of this developer workshop, I built my own Langgraph agent. Test the new agent using code/agent_client.ipynb Notebook.
summary
Building an AI agent requires understanding both theoretical fundamentals and practical implementation challenges. This workshop provides a comprehensive path from basic concepts to complex agent systems, highlighting practical learning using production-grade tools and techniques.
By completing this workshop, developers will gain hands-on experience at:
- Basic Agent Concepts: Understand the difference between workflows and intelligent agents.
- National Management: Implementing complex state transitions and persistence.
- Tool Integration: Creating and managing external tool functions.
- Modern AI stack: Use Langgraph, Nvidia nim and related tools.
learn more
Join Nemotron Labs Livestream for hands-on learning, tips and tricks.Building an AI agent for report generation using Nvidia Nemotron in OpenRouterTuesday, September 16th at 11am
Join Nvidia News, join the community and keep up to date with Agent AI, Nemotron and more by tracking Nvidia AI on LinkedIn, Instagram, X, Facebook. Check out our self-paced video tutorials and live streams here.
