Draft : Add agent astronomy shop and astronomy shop MCP server#3148
Draft : Add agent astronomy shop and astronomy shop MCP server#3148fali007 wants to merge 15 commits intoopen-telemetry:mainfrom
Conversation
Signed-off-by: felixgeorge <felix.george@ibm.com>
Signed-off-by: felixgeorge <felix.george@ibm.com>
Signed-off-by: felixgeorge <felix.george@ibm.com>
Signed-off-by: felixgeorge <felix.george@ibm.com>
Signed-off-by: felixgeorge <felix.george@ibm.com>
Signed-off-by: felixgeorge <felix.george@ibm.com>
|
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
requested in otel-demo sig. [open-telemetry#3140] [open-telemetry#3148]
Signed-off-by: felixgeorge <felix.george@ibm.com>
| @@ -0,0 +1,140 @@ | |||
| #!/usr/bin/python | |||
There was a problem hiding this comment.
Looks like this is a dupe for src/agents/tools.py Can we just keep one?
|
|
||
| def convert_currency(from_currency: str, to_currency: str, amount: float): | ||
| """Convert between currencies.""" | ||
| url = f"http://{BASE_URL}/api/currency/convert?from={from_currency}&to={to_currency}&amount={amount}" |
There was a problem hiding this comment.
Where is this route hosted? I see that the src/frontend/pages/api/currency.ts is the only handler to GET returning currencyCodes[]`. Currency conversion is done internally via gRPC (CurrencyGateway.convert) and is never exposed over HTTP.
|
|
||
| def get_shipping_quote(address_id: str): | ||
| """Get estimated shipping cost for a given address.""" | ||
| url = f"http://{BASE_URL}/api/shipping/quote/{address_id}" |
There was a problem hiding this comment.
/api/shipping/quote/{address_id} does not exist. The actual endpoint is GET /api/shipping with query parameters itemList (JSON-stringified CartItem[]), currencyCode, and address (JSON-stringified Address). Should be something like:
url = f"http://{BASE_URL}/api/shipping"
params = {"itemList": json.dumps(items), "currencyCode": currency, "address": json.dumps(address)}
|
|
||
| def get_cart(): | ||
| """Retrieve the current contents of a user's cart.""" | ||
| url = f"http://{BASE_URL}/api/cart" |
There was a problem hiding this comment.
Do we need session id here
def get_cart(sessionId: str):
url = f"http://{BASE_URL}/api/cart"
res = requests.get(url, params={"sessionId": sessionId})
There was a problem hiding this comment.
Added session_id as request param
| if use_vcr: | ||
| cassette_name = f"{model_name.replace('/', '_')}_casette.yaml" | ||
| if "http_async_client" not in kwargs: | ||
| kwargs["http_async_client"] = httpx.AsyncClient(verify=False) |
There was a problem hiding this comment.
Should we gate this behind an env var (e.g., LLM_TLS_VERIFY). ? LLM provider is external is usually external so should we default to verify=True
| jaeger: | ||
| condition: service_started | ||
| otel-collector: | ||
| condition: service_started | ||
| product-catalog: | ||
| condition: service_started |
There was a problem hiding this comment.
The chatbot only talks to the agent service, but its depends_on lists jaeger, otel-collector, and product-catalog. It should depend on agent instead.
There was a problem hiding this comment.
Corrected the dependency for MCP and chatbot
| AGENT_PORT=8010 | ||
| CHATBOT_PORT=7860 | ||
| LLM_BASE_URL= | ||
| LLM_MODEL=Azure/gpt-4o |
There was a problem hiding this comment.
LLM_MODEL=Azure/gpt-4o the OpenTelemetry demo shouldn't default to a vendor-specific model. Please consider leaving this empty or using a placeholder with a comment explaining how to configure it.
| return f"Error fetching ads: {e}" | ||
|
|
||
|
|
||
| def add_to_cart(userId: str, productId: str, quantity: int = 1): |
There was a problem hiding this comment.
The parameter names mix camelCase and snake_case: userId, productId (camelCase) vs product_id, from_currency, to_currency (snake_case). Since these become tool parameter names visible to the LLM, inconsistency can cause the agent to use wrong names. Please pick one convention (snake_case is Pythonic).
|
|
||
|
|
||
| async def start_servers(): | ||
| """Run both the LangGraph Agent and the MCP server concurrently.""" |
There was a problem hiding this comment.
This looks like a stale docstring. We can say this runs the chat UI server?
|
|
||
|
|
||
| async def start_servers(): | ||
| """Run both the LangGraph Agent and the MCP server concurrently.""" |
There was a problem hiding this comment.
Same here, This looks like a stale docstring. We can say this runs the MCP server?
Signed-off-by: felixgeorge <felix.george@ibm.com>
Signed-off-by: felixgeorge <felix.george@ibm.com>
Signed-off-by: felixgeorge <felix.george@ibm.com>
Changes
This is a Draft PR to demo changes to address #3140
Please provide a brief description of the changes here.
Merge Requirements
For new features contributions, please make sure you have completed the following
essential items:
CHANGELOG.mdupdated to document new feature additionsMaintainers will not merge until the above have been completed. If you're unsure
which docs need to be changed ping the
@open-telemetry/demo-approvers.