Prerequisites
- Python 3.8+
- Maxim Python SDK (
pip install maxim-py
) - OpenAI Python SDK (
pip install openai
) - tiktoken (
pip install tiktoken
) - python-dotenv (
pip install python-dotenv
) - httpx (
pip install httpx
) - API keys for Maxim and OpenAI
1. Load Environment Variables
2. Set Up Maxim Logger and OpenAI Client
3. Define the ReAct Agent Class
The agent follows the ReAct pattern: it reasons, chooses actions (tool calls), observes results, and iterates until it produces an answer.4. Define the System Prompt (ReAct Format)
The system prompt instructs the agent to reason, act, pause, observe, and answer, using available tools.5. Implement Tool Functions
6. Set Up Maxim Session and Trace
7. Run the ReAct Agent with Tracing
The agent will loop, reasoning and calling tools, and each step will be traced as a span in Maxim.8. Example Usage
9. Visualize in Maxim
Each reasoning step, tool call, and answer is now visible as a trace and spans in your Maxim dashboard.For more details, see the Maxim Python SDK documentation.