AbiAgent
What it is
AbiAgentis a supervisor/orchestrator agent built onnaas_abi_core’sIntentAgent.- It discovers available sub-agents from the running
ABIModuleengine, builds “intents” to route requests to them, and exposes a small set of SPARQL-based recommendation tools.
Public API
Class: AbiAgent(IntentAgent)
Operator-facing entry point for creating the orchestrator agent.
Class attributes
name: str = "Abi"description: strlogo_url: strsystem_prompt: str
Orchestration prompt with constraints (no fabricated capabilities, preserve user language, etc.).suggestions: list[dict]
UI/UX suggestion(s) (e.g., “Abi Presentation”).
Methods
get_model() -> ChatModel(static)
Returns the default chat model vianaas_abi.models.default.get_model().get_tools(cls) -> list(static)
Builds tool instances from thenaas_abi_core.modules.templatablesparqlquerymodule, limited to:find_business_proposal_agentsfind_coding_agentsfind_math_agentsfind_best_value_agentsfind_fastest_agentsfind_cheapest_agents
get_agents(cls) -> tuple[list, AgentSharedState](static)
Discovers agent classes from all loaded modules inABIModule.get_instance().engine.modules, instantiates/duplicates them, and returns:agents: list of sub-agent instancesagent_shared_state:AgentSharedState(thread_id="0", supervisor_agent="Abi")
Also avoids adding itself as a sub-agent (prevents recursion).
get_intents(agents: list) -> list(static)
BuildsIntententries for:- “Chat with {agent.name} Agent” (DIRECT scope)
- Each agent’s own
intents(if present), excluding those withIntentScope.DIRECT
New(agent_shared_state: Optional[AgentSharedState]=None, agent_configuration: Optional[AgentConfiguration]=None) -> AbiAgent(class method)
Factory that:- collects tools, agents, intents
- constructs an
AgentConfigurationif none provided (injects tool/agent summaries intosystem_promptviareplace("[TOOLS]", ...)andreplace("[AGENTS]", ...)) - returns a fully constructed
AbiAgent
Configuration/Dependencies
- Depends on a configured
naas_abi.ABIModulesingleton with anengine.modulesregistry. - Requires the module key:
"naas_abi_core.modules.templatablesparqlquery"to be present inengine.modules, and to be an instance ofnaas_abi_core.modules.templatablesparqlquery.ABIModule(asserted). - Uses
naas_abi_core.loggerfor debug logging inNew(). - Run hint (from docstring):
LOG_LEVEL=DEBUG uv run abi chat abi AbiAgent
Usage
Minimal creation of the agent instance:
from naas_abi.agents.AbiAgent import AbiAgent
abi = AbiAgent.New()
print(abi.name)
Caveats
- Tool availability depends on the
templatablesparqlquerymodule being loaded under the exact module key inABIModule.get_instance().engine.modules(an assertion will fail otherwise). - Sub-agents are discovered dynamically from loaded modules; if no modules expose agents,
agents(and derived intents) may be empty. agent_shared_statepassed toNew()is ignored/overwritten byget_agents()in the current implementation.