Agent toolkit
The Knock agent toolkit exposes a set of tools that your AI agent applications can use to interact with Knock via function calling. Using the Knock agent toolkit, you can:
- Give your AI agent applications the ability to send cross-channel notifications to your users.
- Power rich human-in-the-loop flows that allow your agents to solicit structured input from users, or require human approval of actions taken by your agents.
- Let your agents create and manage resources within your Knock account.
Workflows-as-tools
By default the agent toolkit will expose each of your workflows as a tool that your agents can invoke to power cross-channel messaging. If you have a workflow (comment-created
) within your Knock account, the agent toolkit will expose a trigger_comment_created_workflow
tool that your agents can invoke to send a notification.
Each tool describes the parameters that are required to trigger the workflow, where the parameters for the data payload are read from the workflow's trigger data JSON schema. Adding the JSON schema for your workflow trigger data allows the LLM to understand the exact shape and definition of the data payload for the workflow.
If the workflow does not specify a trigger data JSON schema, the tool will define a generic data payload for the AI agent to fill in.
You can control this behavior by either:
- Disabling entirely by setting
workflows.read
tofalse
- Specifying a list of workflow keys that are allowed to be exposed to the agent (
workflows.read = ["comment-created"]
)
Read more about exposing workflows as tools.
Human-in-the-loop flows
You can use the agent toolkit to power rich human-in-the-loop interactions.
For example, you can use the agent toolkit to create a workflow that allows a person to approve or reject the agent's work, where the approval is an actionable notification sent by Knock.
The toolkit exposes wrappers for requiring asynchronous human input. When wrapped, your tools will first delegate to Knock to trigger a workflow that you define, then asynchronously continue tool execution once you have received a response from a human.
You can read more about powering human-in-the-loop flows in the guide.
Creating Knock resources
You can create Knock resources using the agent toolkit through function calling.
For example, you may want an agent to create or update a user's record in Knock as part of your agent workflow, or subscribe a user to another object so they can receive notifications later.
The agent toolkit exposes most common Knock resources as tools that your agents can invoke.
You can find the list of available tools in the tools reference.
Security and authorization
To authenticate with the Knock agent toolkit, you need to provide a service token for your Knock account. This token should be kept secret and not exposed to the LLM. Your service token grants access to all of your Knock resources, so it's important to keep it secure.
You can also customize the tools exposed to the AI Agent by specifying a set of permissions that define the resources that the agent has access to.
For example, the following permissions will expose only the users
resource to the agent, which will include the ability to read and manage users.