KnowledgeGraphBuilderAgent
What it is
A factory-backed agent definition for building and maintaining a knowledge graph (triplestore) via a set of ontology/triplestore tools and pipelines. The module mainly provides:
- Agent metadata (name, avatar, description).
- A detailed
SYSTEM_PROMPTgoverning safe operations (ask confirmation before add/update/merge/remove). create_agent()to assemble anAgentwith the appropriate model, tools, state, and configuration.
Public API
create_agent(agent_shared_state: Optional[AgentSharedState] = None, agent_configuration: Optional[AgentConfiguration] = None) -> Optional[Agent]- Builds and returns a configured
KnowledgeGraphBuilderAgent. - Assembles a chat model and a toolset that supports searching, reading, adding, updating, merging, and removing individuals in a triplestore.
- Builds and returns a configured
class KnowledgeGraphBuilderAgent(Agent)- Concrete agent class (no additional behavior beyond
Agentin this file).
- Concrete agent class (no additional behavior beyond
Configuration/Dependencies
- Core types
naas_abi_core.services.agent.Agent:Agent,AgentConfiguration,AgentSharedState.
- Model
naas_abi.models.default.get_model()supplies the chat model used by the agent.
- Module singleton
naas_abi.ABIModule.get_instance()provides access toMODULE.engine.services.triple_store.
- Tooling assembled in
create_agent()- Workflows/Pipelines (converted to tools via
.as_tools()):SearchIndividualWorkflow(initialized first; its config is passed to the add pipeline)AddIndividualPipelineInsertDataSPARQLPipelineGetSubjectGraphWorkflowUpdateDataPropertyPipelineMergeIndividualsPipelineRemoveIndividualPipeline- Specialized update pipelines:
UpdatePersonPipeline,UpdateSkillPipeline,UpdateCommercialOrganizationPipeline,UpdateLinkedInPagePipeline,UpdateWebsitePipeline,UpdateLegalNamePipeline,UpdateTickerPipeline
- Ontology/SPARQL query tools from:
naas_abi_core.modules.templatablesparqlquery.ABIModule.get_instance().get_tools(...)- Tool names requested:
search_class,count_instances_by_class,get_individuals_from_class,search_individuals_from_class,add_individual,update_data_property,merge_individuals,remove_individuals
- Workflows/Pipelines (converted to tools via
- Default configuration
- If no
agent_configurationis provided:AgentConfiguration(system_prompt=SYSTEM_PROMPT) - If no
agent_shared_stateis provided:AgentSharedState()
- If no
Usage
from naas_abi.agents.KnowledgeGraphBuilderAgent import create_agent
agent = create_agent()
# agent is an instance of KnowledgeGraphBuilderAgent with tools attachedCaveats
- The agent’s
SYSTEM_PROMPTexplicitly requires user confirmation before performing operations that mutate the triplestore: ADD, INSERT DATA, UPDATE, MERGE, REMOVE. - Tool availability depends on
ABIModulebeing initialized and providingMODULE.engine.services.triple_store.