jupyter.agent
AI agent for chat.
create_jupyter_chat_agent
def create_jupyter_chat_agent(
model: str | None = None,
timeout: float = 60.0,
mcp_server: MCPServerStreamableHTTP | None = None) -> Agent | None
Create the main chat agent for JupyterLab.
Arguments:
model- Full model string (e.g., "openai:gpt-4o", "azure-openai:gpt-4o-mini").timeout- HTTP timeout in seconds for API requests (default: 60.0)mcp_server- Optional MCP server connection for Jupyter tools
Returns:
Configured Pydantic AI agent, or None if creation fails (e.g., missing API keys)
Notes:
For Azure OpenAI, requires these environment variables:
- AZURE_OPENAI_API_KEY
- AZURE_OPENAI_ENDPOINT (base URL only, e.g., https://your-resource.openai.azure.com)
- AZURE_OPENAI_API_VERSION (optional, defaults to latest)