Skip to main content
AgentKit lets you run your own backend for live voice conversations. Rapida handles telephony + STT + TTS, while your server handles reasoning and tool execution over a bidirectional gRPC stream. With AgentKit, you can connect any LLM backend with Rapida over gRPC.

Quickstart

1

Create an AgentKit assistant in Rapida

AgentKit assistant configuration in Rapida
  1. Open your Rapida dashboard and create (or edit) an assistant.
  2. In provider/model settings, choose AgentKit as the LLM backend.
  3. Configure the AgentKit connection:
    • AgentKit endpoint: your gRPC server address, such as agent.your-domain.com:50051
    • Metadata: gRPC metadata sent on the Talk stream, such as authorization or tenant routing keys
    • Connection tuning: connect timeout, keepalive, and max message sizes
    • Security: transport security, TLS verification, TLS server name, and optional CA certificate
  4. Save the assistant version and release it.
  5. Attach your voice deployment channel (phone/web/etc.) to this version.
Your AgentKit endpoint must be reachable from the Rapida network and should be provided as host:port, without http://, https://, or grpc://. Localhost works only for local development setups where connectivity is bridged.
2

Start from official examples

Use the Python or Node.js starter depending on your backend stack.
Node.js reference implementation: agentkit/index.js.
3

Implement required stream flow

Implement Talk(...) using the lifecycle contract described in Stream Lifecycle below.Minimum required order:
  1. handle initialization first and acknowledge it
  2. handle optional configuration updates
  3. process message turns and stream assistant/tool outputs
If initialization is not handled first, conversations can fail with request-shape errors.
Node.js servers implement the same flow by extending AgentKitAgent and writing responses to the gRPC stream:
4

Implement tool lifecycle

For each tool execution in your backend:
  1. emit tool_call(...)
  2. execute tool locally
  3. emit tool_call_result(...)
  4. continue assistant response (or send call directive)
For call-ending directives (END_CONVERSATION / TRANSFER_CONVERSATION), include toolId and name in the directive payload.
5

Configure security

Token auth:
In Rapida, add the same token as AgentKit metadata. For example, set metadata key authorization to the shared token if your server checks the gRPC authorization metadata key.TLS:
6

Validate before customer traffic

Use the test client:
Validate:
  • initialization acknowledgement
  • assistant chunks and final response
  • tool call and tool call result events (for tooling flows)

AgentKit configuration options

AgentKit versions store both the backend address and the gRPC connection policy. Use the same fields when you create a new AgentKit assistant or create a new AgentKit version for an existing assistant.
Do not use SKIP_VERIFY or PLAINTEXT for production internet-facing traffic unless the connection is protected by another trusted network boundary.

Runtime overrides

You can override AgentKit connection settings for a single outbound phone call by passing agentkit.* keys in CreatePhoneCallRequest.options. Runtime overrides apply only to the conversation being created.
agentkit.* keys configure Rapida’s connection to your AgentKit server. They are not forwarded in the AgentKit initialization payload. Other call options remain available to your backend through the initialization options map.

API shape

Use agentkit inside CreateAssistantProviderRequest for both initial assistant creation and new AgentKit versions.
See Create assistant provider for SDK examples.

Stream Lifecycle

The AgentKit stream is long-lived and stateful. Treat it as a lifecycle, not as isolated RPC requests.

Lifecycle phases

  1. Receive message and extract msg_id + text.
  2. Emit one or more assistant_response(..., completed=False) chunks.
  3. If tool is needed:
    • emit tool_call(msg_id, tool_id, name, args)
    • execute tool
    • emit tool_call_result(msg_id, tool_id, name, result, success=...)
  4. Emit final assistant_response(..., completed=True) for that turn.
  5. Repeat for next message frame until stream closes.

State and correlation rules

  • initialization is always first and must be acknowledged.
  • assistant.id, toolCall.id, and toolCallResult.id should match the current message.id.
  • tool_id must be stable between tool_call and tool_call_result.
  • Final assistant frame per user turn must set completed=True.
  • For call-ending/transfer directives, include toolId and name for correlation.

Request Types (TalkInput)


Response Types (TalkOutput)

Keep the same tool_id between tool_call and tool_call_result. For call-ending directives, include toolId and name for correlation.

Utilities

Response Builder Utilities (AgentKitAgent)

Request Helper Utilities (AgentKitAgent)


Local Development Setup (ngrok)

For local development, expose your AgentKit server to Rapida with ngrok:
ngrok prints a forwarding endpoint like:
  • tcp://0.tcp.ngrok.io:12345
Use the host and port (0.tcp.ngrok.io:12345) as the AgentKit URL in your Rapida assistant configuration. Development notes:
  • keep the local AgentKit server running on port 50051 during testing
  • if auth is enabled, set the same token in Rapida AgentKit provider config
  • if ngrok restarts, the endpoint changes unless a reserved domain is configured

Example Matrix (GitHub)

Python base path:
  • https://github.com/rapidaai/rapida-python-recipes/tree/main
Node.js base path:
  • https://github.com/rapidaai/rapida-nodejs-recipes/tree/main

Production Checklist

  • handle initialization first on every stream
  • always send final assistant_response(..., completed=True)
  • keep tool_id consistent between tool_call and tool_call_result
  • include toolId + name for call-ending directives
  • do not hardcode secrets in source code
  • configure TLS + auth for production
  • review AgentKit scaling before production traffic