Skip to content

Make KnowledgeBase lifecycle and outgoing calls async #31

@DaviddeBest-TNO

Description

@DaviddeBest-TNO

Parent

#27

What to build

Convert all KnowledgeBase lifecycle methods and outgoing KI calls to async def, completing the migration of the public API surface.

Lifecycle methods: connect(), register(), unregister(), sync_knowledge_interactions() all become async def. They now await the underlying async Client methods.

Outgoing calls: ask() and post() become async def. They await the client's async ask()/post() methods. This enables making multiple outgoing KI calls concurrently via asyncio.gather().

Handler invocation: call() becomes async def, awaiting the now-async dispatch().

Close: Add a close() method to KnowledgeBase that delegates to self.client.close() to properly shut down the httpx.AsyncClient.

Builder: KnowledgeBaseBuilder.build() stays synchronous — it configures and returns a KnowledgeBase whose lifecycle methods are then called asynchronously by the user. Minor adjustments may be needed if build() calls any methods that are now async.

Acceptance criteria

  • connect(), register(), unregister(), sync_knowledge_interactions() are async def
  • ask() and post() are async def
  • call() is async def
  • close() method added to KnowledgeBase, delegates to client
  • KnowledgeBaseBuilder.build() remains synchronous
  • All lifecycle, ask/post, KI registration, and builder tests updated and passing
  • uv run ruff check . passes

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-agentIssue is ready for agent implementation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions