How It Works
Quick Start
Run YAML — framework auto-detected
ag2 is registered and can be requested explicitly via --framework ag2 or framework: ag2 in YAML, but it is not part of the auto-detect chain because its adapter is an unimplemented stub. Selecting it explicitly will raise NotImplementedError at run time until a full implementation lands.API Reference
| Function | Signature | Behaviour |
|---|---|---|
is_available(name: str) -> bool | Raises ValueError on unknown name | Cached on first call (double-checked locking under threading.Lock) |
invalidate(name: str | None = None) -> None | Pass None to clear the whole cache | Useful in tests that monkey-patch importlib |
Known Probe Names
The following framework names are supported:| Name | Detection Method | Notes |
|---|---|---|
crewai | importlib.util.find_spec("crewai") | Standard probe |
autogen | importlib.util.find_spec("autogen") | AutoGen v0.2 package |
autogen_v4 | find_spec("autogen_agentchat") + find_spec("autogen_ext") | AutoGen v0.4 packages |
ag2 | Distribution + namespace check | See AG2 Detection below |
praisonaiagents | import praisonaiagents | PraisonAI agents framework |
praisonai_tools | import praisonai_tools | PraisonAI tools package |
agentops | import agentops | AgentOps observability |
litellm | import litellm | LiteLLM package |
openai | import openai | OpenAI Python client |
chromadb | importlib.util.find_spec("chromadb") | Vector store backend; used by ChromaVectorStore |
pinecone | importlib.util.find_spec("pinecone") | Vector store backend; used by PineconeVectorStore |
qdrant_client | importlib.util.find_spec("qdrant_client") | Vector store backend |
weaviate | importlib.util.find_spec("weaviate") | Vector store backend |
langgraph | find_spec("langgraph") + find_spec("langgraph.prebuilt") | LangGraph framework |
openai_agents | Distribution check + from agents import Runner | OpenAI Agents SDK |
google_adk | _google_adk_probe() — three-step: dist check → google.adk spec → Agent import | Google ADK framework; True only when all three steps pass |
google_adk detection uses a three-step probe in _google_adk_probe(): (1) importlib.metadata.distribution("google-adk") — the PyPI dist must be installed; (2) importlib.util.find_spec("google.adk") — the namespace must be discoverable; (3) from google.adk.agents import Agent with fallback to from google.adk import Agent. All three must succeed for is_available("google_adk") to return True. Install with pip install 'praisonai-frameworks[google-adk]' or pip install 'praisonai[google-adk]'.praisonai.adapters.vector_stores calls is_available("chromadb") / is_available("pinecone") rather than maintaining its own _check_* helpers.
autogen_v2 is an adapter name registered in FrameworkAdapterRegistry, not a probe name in _framework_availability. The probe name remains autogen (it imports the autogen v0.2 package). Use the adapter’s .is_available() method to test whether a specific adapter will dispatch successfully — it folds in the implemented marker.Adapter Availability vs Framework Availability
Two distinct concepts affect whether an AutoGen-family adapter will actually work:| Question | API |
|---|---|
| ”Is the underlying package importable?” | is_available("autogen") from _framework_availability |
”Will calling adapter.run(...) actually work?” | AutoGenV4Adapter().is_available() (folds implemented flag) |
False because implemented = False. This is the safety-by-default behaviour added in PR #2086.
AG2 Detection Quirk
AG2 ships under theautogen namespace, so is_available("ag2") checks both:
importlib.metadata.distribution('ag2')- Ensures AG2 distribution is installedimportlib.util.find_spec("autogen")- Ensuresautogennamespace is importable
Cache Management
Results are cached indefinitely until explicitly invalidated:Thread Safety
The availability checker uses double-checked locking underthreading.Lock for thread-safe caching:
Custom Adapter Usage
Plugin authors can use_framework_availability for their is_available() implementations:
Testing Support
Useinvalidate() in tests that mock importlib:
Backward-compat constants on praisonai.agents_generator
Six module-level constants are available for backward compatibility and can be imported directly from praisonai.agents_generator.
| Constant | Equivalent to |
|---|---|
PRAISONAI_TOOLS_AVAILABLE | is_available("praisonai_tools") |
CREWAI_AVAILABLE | is_available("crewai") |
AUTOGEN_AVAILABLE | is_available("autogen") |
AG2_AVAILABLE | is_available("ag2") |
PRAISONAI_AVAILABLE | is_available("praisonaiagents") |
AGENTOPS_AVAILABLE | is_available("agentops") |
is_available("crewai") directly rather than importing these constants.
Best Practices
Prefer adapter.is_available() for dispatch decisions
Prefer adapter.is_available() for dispatch decisions
Package probes (
is_available("autogen_v4")) only confirm importability. Use AutoGenV4Adapter().is_available() when you need to know whether execution will actually succeed.Use invalidate() in tests that mock importlib
Use invalidate() in tests that mock importlib
Cached results persist for the process lifetime. Call
invalidate() before and after monkey-patching importlib so probes re-run cleanly.Avoid heavy imports inside is_available()
Avoid heavy imports inside is_available()
Custom adapters should delegate to
is_available() rather than importing large packages on every CLI startup probe.Use pick_default() instead of manual priority lists
Use pick_default() instead of manual priority lists
For default framework selection, call
FrameworkAdapterRegistry.pick_default() rather than hard-coding probe tuples.Related
Framework Adapter Plugins
Creating custom framework adapters
AutoGen Framework
AutoGen framework integration
Google ADK Framework
Google ADK framework integration

