API Reference
This section provides a detailed API reference for all public classes and functions in the AgentHelm framework.
Agent
Agent
Source code in orchestrator/agent.py
8 9 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 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 | |
Functions
__init__(tools, tracer, client)
Source code in orchestrator/agent.py
9 10 11 12 13 | |
run(task)
Source code in orchestrator/agent.py
15 16 | |
run_react(task, max_steps=10)
Source code in orchestrator/agent.py
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 | |
Tools
The @tool decorator
tool(inputs=None, outputs=None, side_effects=None, max_cost=0.0, requires_approval=False, retries=0, compensating_tool=None)
A decorator to register a function as a tool in the orchestration framework. If 'inputs' or 'outputs' are not provided, they will be inferred from the function's type hints.
Source code in orchestrator/core/tool.py
9 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 | |
Tool Registry
TOOL_REGISTRY = {}
module-attribute
Tracer
ExecutionTracer
Source code in orchestrator/core/tracer.py
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 | |
Functions
__init__(storage, approval_handler=None)
Source code in orchestrator/core/tracer.py
15 16 17 18 19 | |
set_trace_context(reasoning, confidence)
Sets the LLM reasoning context for the next trace event.
Source code in orchestrator/core/tracer.py
21 22 23 24 | |
trace_and_execute(tool_func, *args, **kwargs)
Source code in orchestrator/core/tracer.py
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 | |
Event Model
Event
Bases: BaseModel
timestamp: When the event happened. tool_name: The name of the tool that was called. inputs: The arguments the tool was called with. outputs: What the tool returned. execution_time: How long it took to run. error_state: Any error that occurred, or null if it succeeded. llm_reasoning_trace: (For now, this can be a placeholder string). confidence_score: (For now, this can be a placeholder float, like 1.0).
Source code in orchestrator/core/event.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
Attributes
confidence_score = 1.0
class-attribute
instance-attribute
error_state = None
class-attribute
instance-attribute
execution_time
instance-attribute
inputs
instance-attribute
llm_reasoning_trace = 'placeholder'
class-attribute
instance-attribute
outputs
instance-attribute
timestamp
instance-attribute
tool_name
instance-attribute
Storage
BaseStorage (Abstract Base Class)
BaseStorage
Bases: ABC
Abstract base class for trace storage backends.
Source code in orchestrator/core/storage/base.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
Functions
load()
abstractmethod
Load all trace events.
Source code in orchestrator/core/storage/base.py
13 14 15 16 | |
query(filters=None)
Optional: Query traces with filters.
Source code in orchestrator/core/storage/base.py
18 19 20 | |
save(event)
abstractmethod
Save a single trace event.
Source code in orchestrator/core/storage/base.py
8 9 10 11 | |
options: members: - save - load - query
JsonStorage
JsonStorage
Bases: BaseStorage
Source code in orchestrator/core/storage/json_storage.py
7 8 9 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 | |
Attributes
file_path = file_path
instance-attribute
Functions
__init__(file_path)
Source code in orchestrator/core/storage/json_storage.py
8 9 10 11 12 13 | |
exists()
Check if the storage file exists.
Source code in orchestrator/core/storage/json_storage.py
40 41 42 | |
load()
Load data from a JSON file. Returns a list of dictionaries.
Source code in orchestrator/core/storage/json_storage.py
30 31 32 33 34 35 36 37 38 | |
save(data, override=False)
Save data to a JSON file. If override is True, it will replace the entire file content. If override is False, it will append the data to the existing list.
Source code in orchestrator/core/storage/json_storage.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
options: members: - init - save - load - exists
SqliteStorage
SqliteStorage
Bases: BaseStorage
Source code in orchestrator/core/storage/sqlite_storage.py
7 8 9 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 111 112 113 114 | |
Attributes
db_path = db_path
instance-attribute
Functions
__init__(db_path)
Source code in orchestrator/core/storage/sqlite_storage.py
8 9 10 | |
load()
Source code in orchestrator/core/storage/sqlite_storage.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
query(filters=None)
Query traces with SQL-level filtering for better performance.
Source code in orchestrator/core/storage/sqlite_storage.py
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 | |
save(event)
Source code in orchestrator/core/storage/sqlite_storage.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
options: members: - init - save - load - query
LLM Clients
LLMClient
Bases: object
Source code in orchestrator/llm/base.py
1 2 3 4 5 6 7 8 | |
Functions
__init__(model_name, base_url, api_key)
Source code in orchestrator/llm/base.py
2 3 4 5 | |
predict(system_prompt, user_prompt)
Source code in orchestrator/llm/base.py
7 8 | |
MistralClient
Bases: LLMClient
A client for interacting with the Mistral AI API.
Source code in orchestrator/llm/mistral_client.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
Functions
__init__(model_name, api_key, base_url='https://api.mistral.ai/v1')
Source code in orchestrator/llm/mistral_client.py
8 9 10 11 | |
predict(system_prompt, user_prompt)
Calls the Mistral Chat Completions API.
Source code in orchestrator/llm/mistral_client.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
OpenAIClient
Bases: LLMClient
Source code in orchestrator/llm/openai_client.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
Functions
__init__(model_name, api_key, base_url='https://api.openai.com/v1')
Source code in orchestrator/llm/openai_client.py
6 7 8 9 | |
predict(system_prompt, user_prompt)
Source code in orchestrator/llm/openai_client.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
Approval Handlers
ApprovalHandler
Source code in orchestrator/core/handlers.py
1 2 3 | |
Functions
request_approval(tool_name, arguments)
Source code in orchestrator/core/handlers.py
2 3 | |
CliHandler
Bases: ApprovalHandler
Source code in orchestrator/core/handlers.py
6 7 8 9 10 11 12 13 | |
Functions
request_approval(tool_name, arguments)
Source code in orchestrator/core/handlers.py
7 8 9 10 11 12 13 | |