Adapters¶
Framework adapters for integrating with agent frameworks.
Base Adapter¶
agentprobe.adapters.base
¶
Abstract base adapter with trace-building helper.
Subclasses implement _invoke() while the base class provides
a _TraceBuilder for accumulating mutable state before producing
a frozen Trace.
BaseAdapter
¶
Bases: ABC
Abstract base class for agent framework adapters.
Provides a public invoke() method that wraps _invoke()
with error handling and logging.
Attributes:
| Name | Type | Description |
|---|---|---|
_name |
The adapter's name. |
Source code in src/agentprobe/adapters/base.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
name
property
¶
Return the adapter name.
__init__(name)
¶
Initialize the adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
A unique name identifying this adapter instance. |
required |
invoke(input_text, **kwargs)
async
¶
Invoke the agent and return a trace.
Wraps _invoke() with error handling and logging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_text
|
str
|
The input prompt to send to the agent. |
required |
**kwargs
|
Any
|
Additional adapter-specific arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
Trace
|
A complete execution trace. |
Raises:
| Type | Description |
|---|---|
AdapterError
|
If the agent invocation fails. |
Source code in src/agentprobe/adapters/base.py
LangChain Adapter¶
agentprobe.adapters.langchain
¶
LangChain framework adapter.
Wraps a LangChain agent (AgentExecutor or RunnableSequence) and translates its execution into AgentProbe's Trace format by extracting intermediate steps and token usage via callback instrumentation.
LangChainAdapter
¶
Bases: BaseAdapter
Adapter for LangChain agents (AgentExecutor or Runnable).
Captures intermediate steps (tool calls) and token usage from LangChain's callback metadata to build a complete execution trace.
Attributes:
| Name | Type | Description |
|---|---|---|
agent |
The LangChain agent or runnable to invoke. |
|
model_name |
The model name to use in trace records. |
Source code in src/agentprobe/adapters/langchain.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
__init__(agent, *, name='langchain', model_name=None)
¶
Initialize the LangChain adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
Any
|
A LangChain AgentExecutor or Runnable. |
required |
name
|
str
|
Adapter name for identification. |
'langchain'
|
model_name
|
str | None
|
Model name to record in traces. |
None
|
Source code in src/agentprobe/adapters/langchain.py
CrewAI Adapter¶
agentprobe.adapters.crewai
¶
CrewAI framework adapter.
Wraps a CrewAI Crew object and translates its execution into AgentProbe's Trace format by extracting task results and tool usage from the crew output.
CrewAIAdapter
¶
Bases: BaseAdapter
Adapter for CrewAI Crew objects.
Captures task results and tool usage from CrewAI's kickoff output to build a complete execution trace.
Attributes:
| Name | Type | Description |
|---|---|---|
_crew |
The CrewAI Crew object to invoke. |
|
_model_name |
Optional model name for trace records. |
Source code in src/agentprobe/adapters/crewai.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
__init__(crew, *, name='crewai', model_name=None)
¶
Initialize the CrewAI adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crew
|
Any
|
A CrewAI Crew object. |
required |
name
|
str
|
Adapter name for identification. |
'crewai'
|
model_name
|
str | None
|
Model name to record in traces. |
None
|
Source code in src/agentprobe/adapters/crewai.py
AutoGen Adapter¶
agentprobe.adapters.autogen
¶
AutoGen framework adapter.
Wraps an AutoGen agent chat session and translates the message history into AgentProbe's Trace format by parsing conversation turns.
AutoGenAdapter
¶
Bases: BaseAdapter
Adapter for AutoGen agent conversations.
Captures message history from AutoGen's chat interface and translates function calls and assistant responses into a structured trace.
Attributes:
| Name | Type | Description |
|---|---|---|
_agent |
The primary AutoGen agent (e.g. AssistantAgent). |
|
_user_proxy |
The user proxy agent for initiating chats. |
|
_model_name |
Optional model name for trace records. |
Source code in src/agentprobe/adapters/autogen.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
__init__(agent, user_proxy, *, name='autogen', model_name=None)
¶
Initialize the AutoGen adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
Any
|
An AutoGen AssistantAgent or similar. |
required |
user_proxy
|
Any
|
An AutoGen UserProxyAgent for initiating chats. |
required |
name
|
str
|
Adapter name for identification. |
'autogen'
|
model_name
|
str | None
|
Model name to record in traces. |
None
|
Source code in src/agentprobe/adapters/autogen.py
MCP Adapter¶
agentprobe.adapters.mcp
¶
MCP (Model Context Protocol) server adapter.
Wraps an MCP server via stdio or HTTP transport and translates tool call results into AgentProbe's Trace format.
MCPAdapter
¶
Bases: BaseAdapter
Adapter for MCP (Model Context Protocol) servers.
Communicates with an MCP server to execute tool calls and captures the results as a structured trace.
Attributes:
| Name | Type | Description |
|---|---|---|
_server |
The MCP server client or connection. |
|
_transport |
Transport type ('stdio' or 'http'). |
|
_model_name |
Optional model name for trace records. |
Source code in src/agentprobe/adapters/mcp.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
__init__(server, *, name='mcp', transport='stdio', model_name=None)
¶
Initialize the MCP adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server
|
Any
|
An MCP server client or connection object. |
required |
name
|
str
|
Adapter name for identification. |
'mcp'
|
transport
|
str
|
Transport protocol ('stdio' or 'http'). |
'stdio'
|
model_name
|
str | None
|
Model name to record in traces. |
None
|
Source code in src/agentprobe/adapters/mcp.py
list_tools()
async
¶
List available tools on the MCP server.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
A list of tool descriptions. |
Raises:
| Type | Description |
|---|---|
AdapterError
|
If the server does not support listing tools. |