๊ฐ€์ž… ํ›„ ์ดˆ๋Œ€ ๋งํฌ๋ฅผ ๊ณต์œ ํ•˜๋ฉด ๋™์˜์ƒ ์žฌ์ƒ ๋ฐ ์ดˆ๋Œ€ ๋ณด์ƒ์„ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture ๆŠ•็จฟใฏๅ€‹ไบบใฎๆ„่ฆ‹ใงใ™ใ€‚
๊ฐ€์ž… May 2026
280 ํŒ”๋กœ์ž‰ ์ค‘    415 ํŒฌ
# Practical and Useful Patterns with ADK ๐Ÿ“œ Got an OpenAPI/Swagger spec? That's all you need to turn APIs into tools โ€” ADK's OpenAPI Tools integrate existing REST APIs into agents with minimal effort. ๐Ÿ“Œ Title: OpenAPI Tools โ€” Auto-Generating Tools from OpenAPI Specs ๐Ÿ”— URL: ๐Ÿงฉ Overview ADK's OpenAPIToolset auto-generates RestApiTool instances from OpenAPI (Swagger) specifications. Each endpoint becomes an agent tool with automatic input validation. Set `auth_scheme` and `auth_credential` once, and authentication is automatically applied to all generated tools โ€” no per-tool auth code needed. ๐Ÿ›  Usage Auto-generating tools from an OpenAPI spec. Import `OpenAPIToolset` from ` and `APIKeyAuth` from `google.adk.auth`. Create the toolset with `OpenAPIToolset(spec_url="", auth_scheme=APIKeyAuth(header_name="X-API-Key"), auth_credential="your-api-key-here")`, which auto-generates tools from the spec with authentication automatically applied to all endpoints. Pass the `toolset` to an `Agent`'s `tools` list to make every API endpoint available as an agent tool. Using a local OpenAPI spec file: For local OpenAPI spec files, load the YAML with ` and pass it as `OpenAPIToolset(spec_dict=spec, base_url="")`, using the `spec_dict` parameter for the parsed dictionary and `base_url` to specify the API's base URL. ๐Ÿ— Practical Patterns **Instant Integration of Existing APIs**: If your internal microservices publish OpenAPI specs, they become agent tools without writing code. The spec's `description` fields serve as tool descriptions, so spec quality directly impacts agent accuracy. To integrate multiple APIs, create separate `OpenAPIToolset` instances for each service -- for example, a user service with `OpenAPIToolset(spec_url="https://user-service.internal/openapi.json", auth_scheme=APIKeyAuth(header_name="Authorization"), auth_credential="Bearer token123")` and an order service with its own spec URL and credentials. Pass both to the `Agent` as `tools=[user_api, order_api]`, allowing per-service access control with different authentication configurations. **Input Validation**: Automatic validation based on OpenAPI schema definitions (required, type, enum, etc.) prevents invalid API calls. **Incremental Integration**: Start by tooling only read-only GET endpoints. Verify behavior, then gradually add POST/PUT/DELETE endpoints. ๐Ÿ’ก Use Cases ๐Ÿข Agent integration of internal microservices ๐Ÿ›’ E-commerce API tooling (product search, order management) ๐Ÿ“Š Natural language queries via data analysis API integration ๐Ÿ”— Third-party SaaS API integration โš ๏ธ Caveats - Insufficient `description` fields in OpenAPI specs prevent the LLM from selecting the right tool. Review spec quality beforehand. - Never hardcode `auth_credential`. Retrieve from environment variables or Secret Manager. - Too many endpoints make LLM tool selection inaccurate. Configure the Toolset with only the endpoints you need. โœจ With OpenAPI Tools, your API specs become agent capabilities directly. Make the most of your existing API documentation! #ADK# #AIAgent#
๋” ๋ณด๊ธฐ