import { ProficientClient } from "@proficient/client";
const proficient = new ProficientClient({
apiKey: process.env.PROFICIENT_AI_PUBLISHABLE_KEY,
userExternalId: "...", // The user's unique ID in your system
});
const agentId = "ag_Lad8YCGGiDLiqIZPWRXmc2ix";
const { interaction } = await proficient.interactions.create({ agentId });
{
"interaction": {
"id": "<string>",
"object": "interaction",
"agent_id": "<string>",
"archived": true,
"created_at": 123,
"initial_turn": "user",
"name": "<string>",
"total_message_count": 123,
"updated_at": 123,
"user_id": "<string>"
},
"messages": [
{
"id": "<string>",
"object": "message",
"content": "<string>",
"created_at": 123,
"depth": 123,
"interaction_id": "<string>",
"sent_by": "user",
"parent_id": "<string>"
}
]
}Creates a new Interaction with an agent.
import { ProficientClient } from "@proficient/client";
const proficient = new ProficientClient({
apiKey: process.env.PROFICIENT_AI_PUBLISHABLE_KEY,
userExternalId: "...", // The user's unique ID in your system
});
const agentId = "ag_Lad8YCGGiDLiqIZPWRXmc2ix";
const { interaction } = await proficient.interactions.create({ agentId });
{
"interaction": {
"id": "<string>",
"object": "interaction",
"agent_id": "<string>",
"archived": true,
"created_at": 123,
"initial_turn": "user",
"name": "<string>",
"total_message_count": 123,
"updated_at": 123,
"user_id": "<string>"
},
"messages": [
{
"id": "<string>",
"object": "message",
"content": "<string>",
"created_at": 123,
"depth": 123,
"interaction_id": "<string>",
"sent_by": "user",
"parent_id": "<string>"
}
]
}import { ProficientClient } from "@proficient/client";
const proficient = new ProficientClient({
apiKey: process.env.PROFICIENT_AI_PUBLISHABLE_KEY,
userExternalId: "...", // The user's unique ID in your system
});
const agentId = "ag_Lad8YCGGiDLiqIZPWRXmc2ix";
const { interaction } = await proficient.interactions.create({ agentId });
The data with which an interaction is created.
The unique identifier of the agent
An object that contains the initial interaction data including the Interaction object itself and the initial messages associated with it.
Users communicate with agents via interactions. You can think of each interaction as a conversation between an agent and user.
Show child attributes
The unique identifier of the interaction
The type of the Interaction object
interaction The unique identifier of the agent
Whether the interaction has been archived by the user
The time at which the object was created, measured in milliseconds since the Unix epoch
Indicates who sends the first message in each interaction. Defaults to "user".
user, agent The name of the interaction
The total number of messages in the interaction
The time at which the object was last updated, measured in milliseconds since the Unix epoch
The unique identifier of the user
Show child attributes
The unique identifier of the message
The type of the Message object
message The content of the message
The time at which the object was created, measured in milliseconds since the Unix epoch
The depth of the message node in the interaction tree. This will be 0 for all root-level messages that mark the beginning of the interaction and increase as the conversation grows longer.
The unique identifier of the interaction
Represents the type of the participant in a given interaction. As an example, message are created by interaction participants so the sent_by property of a Message object must be an InteractionParticipant.
user, agent The ID of the message that directly precedes a given message within a particular conversation.