Description
I’m experimenting with the [Semantic Kernel Python SDK] and trying to use an OpenAPI plugin (for OpenWeatherMap) both for manual function calls and with an agent (like AzureAIAgent).
I’m running into some confusion about how to supply the required API key (appid) when calling these functions, especially when the agent is supposed to handle things.
What I tried:
I loaded my OpenAPI spec using kernel.add_plugin_from_openapi(...) and I can see the functions loaded under kernel.plugins["weather"].
I can see the function, e.g., getCurrentWeather, but when I try await kernel.plugins["weather"]["getCurrentWeather"].invoke(...), I get errors (or the LLM doesn’t pass the key, so the API returns 401 Unauthorized).
When I use an agent and just type “What’s the weather in Hamburg?” the LLM/agent may try to call the tool, but it fails without the key, or it just asks me for the key.
My questions:
What is the correct way to call an OpenAPI function directly in Python SK? (The docs mention .invoke and .invoke_async, but the API surface seems to have changed.)
Is there a way to configure SK Python so that the agent or LLM always supplies my API key to the OpenAPI function call, so it just works for end users? (Like with environment variables, config, or a built-in hook?)
Is there a minimal, modern example that shows how to use OpenAPI plugins with agents, with authentication?
Any code snippets or pointers are super appreciated!
If you need my OpenAPI spec or code, I can provide it.
Thank you! 🙏
Metadata
Metadata
Assignees
Type
Projects
Status