AQIT
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
executor.py
Go to the documentation of this file.
1
# Copyright (c) 2025-present Aquin Labs Private Limited. All Rights Reserved.
2
# This file is part of the Aquin Engine. Unauthorized copying, modification,
3
# distribution, or use of this file, via any medium, is strictly prohibited.
4
# Proprietary and confidential. See LICENSE for terms.
5
6
"""
7
Single execute_tool dispatcher for Step 35.
8
9
execute_tool(name, args, ctx) -> dict
10
bridge.call(name, args, ctx) -> result
11
card_mapper.to_card(name, result) -> card | None
12
attach card on result for agent / dispatch_with_sync callers
13
14
Sync (tool.start / tool.result) is owned by agent.py and sync_dispatch.py —
15
not here — so we never double-push or overwrite cards with a second result.
16
"""
17
from
__future__
import
annotations
18
19
from
typing
import
Any
20
21
22
def
execute_tool
(name: str, args: dict[str, Any], ctx: dict[str, Any]) -> dict[str, Any]:
23
"""
24
Execute a tool by name via bridge, attach card when applicable.
25
Never raises — errors returned as {"error": "..."}.
26
"""
27
from
aquin.compute
import
bridge, card_mapper
28
29
try
:
30
result = bridge.call(name, args, ctx)
31
except
Exception
as
exc:
32
return
{
"error"
: str(exc)}
33
34
if
not
isinstance(result, dict):
35
return
{
"content"
: result}
36
37
card = result.get(
"card"
)
38
if
card
is
None
:
39
card = card_mapper.to_card(name, result)
40
if
card
is
not
None
:
41
result = {**result,
"card"
: card}
42
43
return
result
aquin.compute
Definition
__init__.py:1
aquin.engine.tools.executor.execute_tool
dict[str, Any] execute_tool(str name, dict[str, Any] args, dict[str, Any] ctx)
Definition
executor.py:26
aquin
engine
tools
executor.py
AQIT · Aquin Labs Private Limited · Apache 2.0 · Generated by
1.18.0