Skip to main content
NiadraADK gives you before_model (injects the context), after_model (records the answer) and tools (the history kit as ADK BaseTools). In TypeScript, niadraAdk({ session }) returns the two callbacks and the tools for the ADK for TypeScript.

Install

The TypeScript integration is in @niadra/sdk on npm.

The five primitives

Minimal example

The same code is in examples/google_adk_agent.py.

In TypeScript

niadraAdk({ session }) serves one agent definition for every ADK session: session is a fixed conversation or a function of the context (userId, sessionId, state), called once per ADK session id. beforeModelCallback records the user’s message of each invocation once and adds the pack after your instruction in systemInstruction and the turn_block as a text part of the last user content; ADK rebuilds the request from the session’s events on every call, so nothing of it lands in the session. afterModelCallback records the final answer with usageMetadata and a transfer_to_agent call as a handoff between agents; partial (streamed) responses and tool calls record nothing. tools declares the kit’s JSON Schemas (parametersJsonSchema) and finds the customer from the tool’s context, never from the model’s arguments. Give the same ...memory to sub-agents.

Agent memory

NiadraADK(conversation, agent_memory=True) puts the agent’s own notes before the customer’s context and adds the two tools. See Agent memory.

Turn records

With the turns feature on in the space (it ships on), the adapter’s agent and tool callbacks, with turns=True in Python and turns: true in TypeScript, record each run as a turn record, with each tool call by the provider’s id and each model call with its tokens; a sub-agent or an AgentTool opens a sub-turn. In a replay, ADK tools answer from the record in both languages. A turn never waits for Niadra and never repeats the conversation’s text.

Limits

  • If the agent already has callbacks, pass lists: the ADK runs them in order.
  • Nothing here fails the invocation: without a pack, the request goes on with the agent’s instruction.
  • Tested against google-adk 2.9 with the model replaced by a fake and Niadra on the emulator; in TypeScript, against @google/adk 2.1.0, with a real InMemoryRunner and sub-agents over a scripted model.

Next steps

Google GenAI

the client wrap(), for those not on the ADK.

History navigation

the three tools the agent receives.