|
| 1 | +""" |
| 2 | +agentcard-adapters |
| 3 | +================== |
| 4 | +
|
| 5 | +AgentCard v1.0 adapters for LangChain, CrewAI, and AutoGen. |
| 6 | +
|
| 7 | +Provides bidirectional conversion between major Python AI agent frameworks |
| 8 | +and the AgentCard v1.0 schema (https://github.com/kwailapt/AgentCard). |
| 9 | +
|
| 10 | +Quick start |
| 11 | +----------- |
| 12 | +:: |
| 13 | +
|
| 14 | + pip install agentcard-adapters |
| 15 | +
|
| 16 | +LangChain:: |
| 17 | +
|
| 18 | + from agentcard_adapters import tool_to_agentcard |
| 19 | + card = tool_to_agentcard(my_tool, agent_id="...", endpoint_url="...") |
| 20 | +
|
| 21 | +CrewAI:: |
| 22 | +
|
| 23 | + from agentcard_adapters import agent_to_agentcard # CrewAI |
| 24 | + card = agent_to_agentcard(researcher, agent_id="...", endpoint_url="...") |
| 25 | +
|
| 26 | +AutoGen:: |
| 27 | +
|
| 28 | + from agentcard_adapters.autogen_adapter import agent_to_agentcard |
| 29 | + card = agent_to_agentcard(assistant, agent_id="...", endpoint_url="...") |
| 30 | +
|
| 31 | +Core schema (framework-independent):: |
| 32 | +
|
| 33 | + from agentcard_adapters.core import AgentCard, Capability, Endpoint |
| 34 | + card = AgentCard(agent_id="...", name="My Agent", version="1.0.0", |
| 35 | + capabilities=[...], endpoint=...) |
| 36 | + card.validate() |
| 37 | +
|
| 38 | +License |
| 39 | +------- |
| 40 | +Apache 2.0 + CC-BY 4.0 (spec). |
| 41 | +Patent non-reservation: https://github.com/kwailapt/AgentCard/blob/main/NOTICE |
| 42 | +""" |
| 43 | + |
| 44 | +from .core import ( |
| 45 | + AgentCard, |
| 46 | + AuthConfig, |
| 47 | + Capability, |
| 48 | + Endpoint, |
| 49 | + EpiplexityCert, |
| 50 | + GoalSubscription, |
| 51 | + Metadata, |
| 52 | + PricingModel, |
| 53 | + LANDAUER_FLOOR_JOULES, |
| 54 | +) |
| 55 | + |
| 56 | +# Lazy-import adapters to avoid hard dependencies |
| 57 | +def __getattr__(name: str): # noqa: ANN001 |
| 58 | + if name in ("tool_to_agentcard", "tools_to_agentcard", |
| 59 | + "agentcard_to_tool", "AgentCardMixin"): |
| 60 | + from . import langchain_adapter as _lc |
| 61 | + return getattr(_lc, name) |
| 62 | + if name in ("agent_to_agentcard", "crew_to_agentcards", |
| 63 | + "agentcard_to_agent"): |
| 64 | + from . import crewai_adapter as _cr |
| 65 | + return getattr(_cr, name) |
| 66 | + raise AttributeError(f"module 'agentcard_adapters' has no attribute {name!r}") |
| 67 | + |
| 68 | + |
| 69 | +__all__ = [ |
| 70 | + # Core types |
| 71 | + "AgentCard", |
| 72 | + "AuthConfig", |
| 73 | + "Capability", |
| 74 | + "Endpoint", |
| 75 | + "EpiplexityCert", |
| 76 | + "GoalSubscription", |
| 77 | + "Metadata", |
| 78 | + "PricingModel", |
| 79 | + "LANDAUER_FLOOR_JOULES", |
| 80 | + # LangChain (lazy) |
| 81 | + "tool_to_agentcard", |
| 82 | + "tools_to_agentcard", |
| 83 | + "agentcard_to_tool", |
| 84 | + "AgentCardMixin", |
| 85 | + # CrewAI (lazy) |
| 86 | + "agent_to_agentcard", |
| 87 | + "crew_to_agentcards", |
| 88 | + "agentcard_to_agent", |
| 89 | +] |
| 90 | + |
| 91 | +__version__ = "0.1.0" |
0 commit comments