API Reference
any_agent.AnyAgent
Bases: ABC
Base abstract class for all agent implementations.
This provides a unified interface for different agent frameworks.
Source code in src/any_agent/frameworks/any_agent.py
10 11 12 13 14 15 16 17 18 19 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 |
|
agent
property
The underlying agent implementation from the framework.
This property is intentionally restricted to maintain framework abstraction and prevent direct dependency on specific agent implementations.
If you need functionality that relies on accessing the underlying agent: 1. Consider if the functionality can be added to the AnyAgent interface 2. Submit a GitHub issue describing your use case 3. Contribute a PR implementing the needed functionality
Raises:
Type | Description |
---|---|
NotImplementedError
|
Always raised when this property is accessed |
tools
abstractmethod
property
Return the tools used by the agent. This property is read-only and cannot be modified.
run(prompt)
any_agent.AgentFramework
Bases: str
, Enum
Source code in src/any_agent/config.py
any_agent.AgentConfig
Bases: BaseModel
Source code in src/any_agent/config.py
any_agent.config.MCPStdioParams
any_agent.config.MCPSseParams
any_agent.config.TracingConfig
any_agent.tools
ask_user_verification(query)
Asks user to verify the given query
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
The question that requires verification. |
required |
search_web(query)
Performs a duckduckgo web search based on your query (think a Google search) then returns the top search results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
The search query to perform. |
required |
Returns:
Type | Description |
---|---|
str
|
The top search results. |
Source code in src/any_agent/tools/web_browsing.py
send_console_message(user, query)
Sends the specified user a message via console and returns their response.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
The question to ask the user. |
required |
user
|
str
|
The user to ask the question to. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The user's response. |
Source code in src/any_agent/tools/user_interaction.py
show_final_answer(answer)
Show the final answer to the user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
answer
|
str
|
The final answer. |
required |
show_plan(plan)
Show the current plan to the user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
plan
|
str
|
The current plan. |
required |
visit_webpage(url)
Visits a webpage at the given url and reads its content as a markdown string. Use this to browse webpages.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The url of the webpage to visit. |
required |
Source code in src/any_agent/tools/web_browsing.py
any_agent.tracing
setup_tracing(agent_framework, output_dir='traces', tracing_config=None)
Setup tracing for agent_framework
using openinference.instrumentation
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent_framework
|
AgentFramework
|
The type of agent being used. |
required |
output_dir
|
str
|
The directory where the traces will be stored. Defaults to "traces". |
'traces'
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The name of the JSON file where traces will be stored. |