launch • AI Agent SDK

launch: Launch the agent as an HTTP API endpoint or an MCP server.

launch

Method

</div>

This is a method of the Agent class in the agent module.

Launch the agent as an HTTP API endpoint or an MCP server.

Signature

python
def launch(path: str, port: int, host: str, debug: bool, protocol: str) -> Any

Parameters

ParamField str

API endpoint path (default: ‘/’) for HTTP, or base path for MCP.

ParamField int

Server port (default: 8000)

ParamField str

Server host (default: ‘127.0.0.1’)

ParamField bool

Enable debug mode for uvicorn (default: False)

ParamField str

“http” to launch as FastAPI, “mcp” to launch as MCP server.

Returns

ResponseField Any

None

Uses

  • rstrip
  • logging.error
  • FastAPI
  • logging.warning
  • request.json
  • HTTPException
  • request.form
  • asyncio.iscoroutinefunction
  • achat
  • asyncio.get_event_loop

Source

View on GitHub

praisonaiagents/agent/agent.py at line 6826