Proxy
The ag2 proxy command wraps existing interfaces as AG2-compatible tools.
CLI Wrapping#
Generate typed Python wrappers for CLI commands:
The CLI introspects --help output to extract flags, arguments, and descriptions, then generates @tool-decorated functions that call the CLI via subprocess.
OpenAPI Wrapping#
Generate tools from an OpenAPI/Swagger specification:
This parses the spec and generates one tool per endpoint with proper type hints, authentication handling via environment variables, and error handling.
Python Module Wrapping#
Wrap functions from a Python module:
This introspects function signatures and generates tool wrappers with proper typing.
MCP Serving#
Instead of generating Python files, serve the wrapped tools as an MCP server:
Options#
| Flag | Description |
|---|---|
--command | CLI command to wrap |
--subcommands | Comma-separated subcommands to include |
--openapi | URL or path to OpenAPI spec |
--module | Python module to wrap |
--functions | Comma-separated functions to wrap |
--scripts | Directory of shell scripts to wrap |
--serve-mcp | Serve as MCP server instead of generating files |
--output | Output directory for generated files |