litellm - 💡(How to fix) Fix [Bug]: PydanticAI AG-UI Streamed response error 'no provider_url abstract method'

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

However, I get an error when trying to use LiteLLM:

Fix Action

Fix / Workaround

@app.post('/ag-ui') async def ag_ui(request: Request) -> Response: """ For Streaming https://pydantic.dev/docs/ai/integrations/ui/ag-ui/ """ return await AGUIAdapter.dispatch_request(request, agent=agent)

Code Example

Can't instantiate abstract class LiteLLMStreamedResponse without an implementation for abstract method 'provider_url'

---

from pydantic_ai_litellm import LiteLLMModel

model = LiteLLMModel(
    model_name,
    api_base,
    api_key,
    custom_llm_provider,
)

---

from pydantic_ai import Agent

agent = Agent(
    model,
    instructions='You always respond in Italian.'
)

---

from fastapi import FastAPI
from fastapi.requests import Request
from fastapi.responses import Response
from pydantic_ai.ui.ag_ui import AGUIAdapter

app = FastAPI(title="Pydantic Agent")

@app.get("/health")
def health():
    return {"status": "ok"}

@app.post('/ag-ui')
async def ag_ui(request: Request) -> Response:
    """
    For Streaming
    https://pydantic.dev/docs/ai/integrations/ui/ag-ui/
    """
    return await AGUIAdapter.dispatch_request(request, agent=agent)

---

{"type":"RUN_ERROR","timestamp":1669357945274,"message":"Can't instantiate abstract class LiteLLMStreamedResponse without an implementation for abstract method 'provider_url'"}
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

I am using LiteLLM to handle an LLM endpoint (specifically, it is an OpenAI API).

I have made a Pydantic AI agent, and want to stream a response using the Agent-User Interaction (AG-UI) Protocol.

However, I get an error when trying to use LiteLLM:

Can't instantiate abstract class LiteLLMStreamedResponse without an implementation for abstract method 'provider_url'

I know I can switch to a OpenAI API client, and when I do I have no problems.

Steps to Reproduce

  1. Create LiteLLM model
from pydantic_ai_litellm import LiteLLMModel

model = LiteLLMModel(
    model_name,
    api_base,
    api_key,
    custom_llm_provider,
)
  1. Create PydanticAI Agent
from pydantic_ai import Agent

agent = Agent(
    model,
    instructions='You always respond in Italian.'
)
  1. Create FastAPI app
from fastapi import FastAPI
from fastapi.requests import Request
from fastapi.responses import Response
from pydantic_ai.ui.ag_ui import AGUIAdapter

app = FastAPI(title="Pydantic Agent")

@app.get("/health")
def health():
    return {"status": "ok"}

@app.post('/ag-ui')
async def ag_ui(request: Request) -> Response:
    """
    For Streaming
    https://pydantic.dev/docs/ai/integrations/ui/ag-ui/
    """
    return await AGUIAdapter.dispatch_request(request, agent=agent)

Relevant log output

{"type":"RUN_ERROR","timestamp":1669357945274,"message":"Can't instantiate abstract class LiteLLMStreamedResponse without an implementation for abstract method 'provider_url'"}

What part of LiteLLM is this about?

SDK (litellm Python package)

What LiteLLM version are you on ?

v1.84.0

Twitter / LinkedIn details

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING