Skip to main content

knowledge

kg.find_entity

Find Entity in Knowledge Graph

Effects: read

Find an entity by name in the Knowledge Graph.

USE WHEN user mentions a person, project, company by name and you need:

  • To resolve a name to entity_id for subsequent queries
  • 'Кто работает над X?' → find X first
  • 'Расскажи про Y' → find Y first

RETURNS entity_id for use in kg.get_relationships or kg.explore.
ALWAYS use this as the FIRST step in KG query chains.

Arguments

ArgumentTypeRequiredDescription
entity_typestringnoFilter by entity type: - 'person': People, contacts - 'project': Projects, tasks - 'organization': Companies, teams - 'event': Meetings, deadlines - 'topic': Discussion topics - 'location': Places, addresses - 'document': Files, documents OMIT to include all entity types. (one of person, project, organization, event, topic, location, document)
limitintegernoMaximum results to return (1-10). Default: 5 (default 5; min 1.0; max 10.0)
namestringyesEntity name to search for. Can be in any language (Russian, English, etc.) - transliteration is automatic.

kg.get_relationships

Get Entity Relationships

Effects: read

Get relationships for a specific entity from Knowledge Graph.

USE WHEN:

  • 'Кто работает над X?' - filter by works_on
  • 'С кем общался Y?' - filter by discussed_with
  • 'Кто из компании Z?' - filter by member_of
  • 'Что связано с W?' - no filter, get all

REQUIRES: entity_id from previous kg.find_entity step.
Use: {{step_N.entity_id}} where N is the find_entity step number.

Arguments

ArgumentTypeRequiredDescription
directionstringnoRelationship direction: - 'outgoing': Entity → Others - 'incoming': Others → Entity - 'both': All relationships (default) (one of incoming, outgoing, both; default both)
entity_idstringyesEntity ID from kg.find_entity step. Use {{step_N.entity_id}} reference.
limitintegernoMaximum relationships to return (1-50). Default: 20 (default 20; min 1.0; max 50.0)
relation_typesarraynoFilter by relationship types (optional): People: works_on, works_for, member_of, manages, knows, client_of, provides_service Communication: discussed_with, participated_in, mentioned_in Org/Project: developed_by, funded_by, partnered_with, integrates_with, depends_on, part_of Document: issued_by, issued_to, signed_by, authored_by Other: uses, located_in, about, follows, owns, related_to

knowledge.query

Query Knowledge

Effects: read

Answer questions using knowledge base (uploaded documents, handbooks, files).

Use for QUESTIONS that need an answer synthesized from documents or messages.
Returns an evidence pack with source citations, KG entities, and extracted numbers.

Modes:

  • 'auto' (default): Smart routing — works for most questions
  • 'rag': Semantic search across documents & messages
  • 'entity': Entity-centric queries (e.g., 'Tell me about [entity]')
  • 'relationship': Two-entity queries (e.g., 'How is [entity A] related to [entity B]?')

Examples:

  • 'What did we discuss about the budget?' → knowledge.query
  • 'Tell me about [entity]' → knowledge.query mode=entity
  • 'How is [A] related to [B]?' → knowledge.query mode=relationship

NOT for finding/listing files, threads, or links — use search.files / search.threads / search.links for that.

Arguments

ArgumentTypeRequiredDescription
date_fromstringnoFilter messages from this date (ISO format: YYYY-MM-DD). Use for time-based queries like 'this week', 'last month'.
date_tostringnoFilter messages until this date (ISO format: YYYY-MM-DD).
file_idsarraynoSpecific file IDs to search within (for pinned files). Numeric ids, e.g. [502513]; numeric strings are accepted.
include_relationshipsbooleannoInclude KG relationships in answer (default: true for entity mode) (default True)
max_sourcesintegernoMaximum number of sources to consider (1-10) (default 5; min 1.0; max 10.0)
needs_aggregationbooleannoTrue if query asks for totals/sums/counts.
questionstringyesThe question to answer from user's knowledge base. Required even for entity queries. (min 1.0)
thread_idstringnoLimit search to a specific thread/chat