Skip to content

Conversation

@codefromthecrypt
Copy link
Contributor

This adds an agent (MCP + LLM) example for Envoy AI Gateway, by proxying the anonymous Kiwi MCP server.

This uses the openai-agents python SDK, for parity with the existing chat example, which is openai (normal) python SDK. I tested it with qwen3:1.7b which is the smallest model likely to succeed.

The main difference here between the normal chat, is you'll notice server-side MCP spans. These are generated by Envoy AI gateway and connect to the trace due to metadata propagation implemented on the client, via OpenInference.

Screenshot 2025-10-07 at 4 03 23 PM
$ OPENAI_BASE_URL=http://localhost:1975/v1 MCP_URL=http://localhost:1975/mcp uv run --exact -q --env-file env.local ../agent.py
<think>
Okay, let's tackle this. The user wants the best flight from New York to Kota Kinabalu on October 10, 2025. First, I need to check the function calls. The response has a list of flights with various details.

Looking at the data, the cheapest flight is $651 at 20:30 on October 10, with a duration of 212400 seconds. That's the price group. Then there's another flight at $654, but it's a bit cheaper than the next ones. Wait, no, the first one is $651, then the next is $654. So the cheapest is $651.

The shortest duration is 116400 seconds, which is about 3 hours and 25 minutes. That's the duration group. The rest of the flights are longer. 

So the summary should mention the cheapest flight, the shortest duration, and maybe the best price. The fun fact about Kota Kinabalu is that it's a city in Borneo, known for its tropical climate and biodiversity. 

I need to present this in a table, grouping by price and duration. Make sure to include the details like departure and arrival airports, dates, duration, and the deep link. Also, end with a friendly note and the fun fact.
</think>

### ✈️ Best Flight from New York to Kota Kinabalu (2025-10-10)

| **Category**         | **Details**                                                                 |
|----------------------|-----------------------------------------------------------------------------|
| **Cheapest**         |**$651** (New York → Kota Kinabalu) <br> Departure: Oct 10, 20:30 |  
| **Fastest**          | 🚀 **3h 25m** (New York → Kota Kinabalu) <br> Departure: Oct 10, 20:30 |
| **Layovers**         | ZURICH (ZRH) → NEW DELHI (DEL) → KUALA LUMBAH (KUL) <br> Total Duration: 212,400 sec |

**Flight Details**:
- **Departure**: Oct 10, 20:30 (New York) → Oct 13, 02:30 (Kota Kinabalu)  
- **Cabin**: Economy (M)  
- **Deep Link**: [Book Here](https://on.kiwi.com/IEQFKA)  

**Fun Fact**: Kota Kinabalu is a lush tropical city in Sabah, Borneo, known for its lush rainforests, wildlife, and vibrant culture. 🌿  

✈️ Enjoy your trip! 🌟

Signed-off-by: Adrian Cole <[email protected]>
"url": mcp_url,
"timeout": 30.0,
},
cache_tools_list=True,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a yolo comment since I didn't check it at all, but it wouldn't surprise me if this enables the background polling you saw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah will try!

@anuraaga anuraaga merged commit 577c259 into elastic:main Oct 7, 2025
2 checks passed
mathetake pushed a commit to envoyproxy/ai-gateway that referenced this pull request Oct 7, 2025
**Description**

Adds an example Python agent that is fully instrumented to easily
showcase how tracing works.
This PR borrows the agent code from:
elastic/observability-examples#90

**Related Issues/PRs (if applicable)**

N/A

**Special notes for reviewers (if applicable)**

N/A

---------

Signed-off-by: Ignasi Barrera <[email protected]>
nutanix-Hrushikesh pushed a commit to nutanix-Hrushikesh/ai-gateway that referenced this pull request Oct 16, 2025
**Description**

Adds an example Python agent that is fully instrumented to easily
showcase how tracing works.
This PR borrows the agent code from:
elastic/observability-examples#90

**Related Issues/PRs (if applicable)**

N/A

**Special notes for reviewers (if applicable)**

N/A

---------

Signed-off-by: Ignasi Barrera <[email protected]>
Signed-off-by: Hrushikesh Patil <[email protected]>
nutanix-Hrushikesh pushed a commit to nutanix-Hrushikesh/ai-gateway that referenced this pull request Oct 16, 2025
**Description**

Adds an example Python agent that is fully instrumented to easily
showcase how tracing works.
This PR borrows the agent code from:
elastic/observability-examples#90

**Related Issues/PRs (if applicable)**

N/A

**Special notes for reviewers (if applicable)**

N/A

---------

Signed-off-by: Ignasi Barrera <[email protected]>
Signed-off-by: Hrushikesh Patil <[email protected]>
nutanix-Hrushikesh pushed a commit to nutanix-Hrushikesh/ai-gateway that referenced this pull request Oct 16, 2025
**Description**

Adds an example Python agent that is fully instrumented to easily
showcase how tracing works.
This PR borrows the agent code from:
elastic/observability-examples#90

**Related Issues/PRs (if applicable)**

N/A

**Special notes for reviewers (if applicable)**

N/A

---------

Signed-off-by: Ignasi Barrera <[email protected]>
Signed-off-by: Hrushikesh Patil <[email protected]>
missBerg pushed a commit to missBerg/ai-gateway that referenced this pull request Dec 20, 2025
**Description**

Adds an example Python agent that is fully instrumented to easily
showcase how tracing works.
This PR borrows the agent code from:
elastic/observability-examples#90

**Related Issues/PRs (if applicable)**

N/A

**Special notes for reviewers (if applicable)**

N/A

---------

Signed-off-by: Ignasi Barrera <[email protected]>
Signed-off-by: Erica Hughberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants