|
5 | 5 | Learn more [here](https://langfuse.com/) |
6 | 6 |
|
7 | 7 | [](https://github.com/langfuse/langfuse) |
| 8 | + |
| 9 | +Below is an outline of the steps involved in a simple Math Agent. Key elements illustrated include: |
| 10 | + |
| 11 | +- A visual breakdown of each step—e.g., when the agent invokes a tool and when control returns to the agent |
| 12 | +- Inputs and outputs at each stage of the process: |
| 13 | + - **User to Agent**: The user asks a natural language question — e.g., `What is 1 + 1?` |
| 14 | + - **Agent to Tool**: The agent decides to call a calculator tool with structured arguments — e.g., `args: { a: 1, b: 1 }`. |
| 15 | + - **Tool to Agent**: The tool executes the operation and returns the result — e.g., `2`. |
| 16 | + - **Agent to User**: The agent responds with the final answer in natural language — e.g., `1 + 1 = 2`. |
| 17 | +- The full chat history throughout the interaction |
| 18 | +- Latency and cost associated with each node |
| 19 | + |
| 20 | +### Step 1: Math Agent (User to Agent → Agent to Tool) |
| 21 | + |
| 22 | +This section shows: |
| 23 | + |
| 24 | +- **User to Agent**: The user asks a natural language question — e.g., `What is 1 + 1?` |
| 25 | +- **Agent to Tool**: The agent decides to call a calculator tool with structured arguments — e.g., `args: { a: 1, b: 1 }`. |
| 26 | +- **Full Chat History Throughout the Interaction**: You can inspect earlier user-agent messages. For instance: |
| 27 | + |
| 28 | +```text |
| 29 | +User: reply only no |
| 30 | +Agent: No. |
| 31 | +``` |
| 32 | + |
| 33 | +In this example, the agent responded directly without calling any tools. |
| 34 | + |
| 35 | +### Step 2: Tool Call (Tool to Agent) |
| 36 | + |
| 37 | +This section shows: |
| 38 | + |
| 39 | + - **Tool to Agent**: The tool executes the operation and returns the result — e.g., `2`. |
| 40 | + |
| 41 | +### Step 3: Math Agent (Agent to User) |
| 42 | + |
| 43 | +This section shows: |
| 44 | + |
| 45 | + - **Agent to User**: The agent responds with the final answer in natural language — e.g., `1 + 1 = 2`. |
0 commit comments