agentscope-ai/agentscope · error · ValueError
f"Unsupported LLM provider: {provider}"
Error message
f"Unsupported LLM provider: {provider}" What it means
A pydantic field_validator on the agentscope LLM config subclass only accepts provider == 'agentscope'; any other provider string re-raises mem0's 'Unsupported LLM provider' error during config parsing.
Source
Thrown at src/agentscope/middleware/_longterm_memory/_mem0/_agentscope_adapter.py:421
other provider continues to be rejected with the same error mem0
would have raised)."""
from pydantic import field_validator
from mem0.embeddings.configs import EmbedderConfig
from mem0.llms.configs import LlmConfig
class _AgentScopeLlmConfig(LlmConfig):
"""``LlmConfig`` subclass that accepts the AgentScope provider."""
@field_validator("config")
@classmethod
def validate_config(cls, v: Any, values: Any) -> Any:
"""Allow ``provider == "agentscope"``; reject everything
else with mem0's original error."""
provider = values.data.get("provider")
if provider == _AGENTSCOPE_PROVIDER:
return v
raise ValueError(f"Unsupported LLM provider: {provider}")
class _AgentScopeEmbedderConfig(EmbedderConfig):
"""``EmbedderConfig`` subclass that accepts the AgentScope
provider."""
@field_validator("config")
@classmethod
def validate_config(cls, v: Any, values: Any) -> Any:
"""Allow ``provider == "agentscope"``; reject everything
else with mem0's original error."""
provider = values.data.get("provider")
if provider == _AGENTSCOPE_PROVIDER:
return v
raise ValueError(
f"Unsupported embedding provider: {provider}",
)
return _AgentScopeLlmConfig, _AgentScopeEmbedderConfigView on GitHub (pinned to e90f1c7592)
Solutions
- Set provider='agentscope' (exact lowercase) on the llm block
- Prefer build_mem0_config which fills the provider automatically
Example fix
// before
MemoryConfig(llm={'provider': 'openai', ...})
// after
MemoryConfig(llm={'provider': 'agentscope', ...}) Defensive patterns
Strategy: validation
Validate before calling
assert llm_block.get('provider') == 'agentscope', 'provider must be exactly "agentscope"' Try / catch
try:
MemoryConfig(**cfg)
except ValueError as e:
if 'Unsupported LLM provider' in str(e):
cfg['llm']['provider'] = 'agentscope'
else:
raise Prevention
- Generate configs with build_mem0_config instead of editing dicts by hand
- Use a lint/test that asserts provider == 'agentscope'
When it happens
Trigger: Building MemoryConfig(llm=...) with the agentscope config classes but provider set to 'openai', 'anthropic', a typo like 'AgentScope', or None.
Common situations: Editing a copied mem0 config and forgetting to change provider; case mismatch after refactor.
Related errors
- f"Unsupported embedding provider: {provider}"
- "AgentScopeLLM requires `model` in the config to be an Agent
- f"AgentScopeLLM `model` must be a ChatModelBase, got {type(s
- "AgentScopeLLM received no usable messages (empty list or al
- "AgentScopeEmbedding requires `model` in the config to be an
AI-assisted analysis of agentscope-ai/agentscope@e90f1c7592 (2026-08-28).
Data as JSON: /api/errors/53236addc7ab70ed.
Report an issue: GitHub.