Multiagent bot in J‑Graph
To get started with AI agents in J‑Graph:
- Set up connection to Caila.
- Add an AI agent block.
This example shows a script in J‑Graph for a bot that helps customers of a streaming service. The script uses two AI agents:
- The first agent recommends a movie for the user.
- The second agent helps choose a subscription.

-
At the beginning of the dialog, the bot immediately transitions to the
Movie
state. In this state, therecommend_movie
agent communicates with the user.Parameters of the
recommend_movie
AI agent-
General settings:
- Agent ID:
recommend_movie
. - LLM:
gpt-4o
. - Agent role:
Streaming service employee
. - Agent goal:
Help the user choose a movie
. - Instructions:
Ask questions about the user’s preferences to choose a movie. Once the user picks a movie, ask if they want to subscribe to the service
.
- Agent ID:
-
History settings:
- Pass the bot dialog history to the agent: parameter enabled.
- Number of recent messages from the history:
50
.
-
Transitions to other states:
- Allow the agent to transfer the dialog to other agents in the script: parameter enabled.
- Next state if the agent achieved the goal:
Feedback
.
-
-
The
recommend_movie
agent asks the user for their preferences and suggest movies. The agent continues until the user selects a movie. Next, the agent offers to subscribe to the streaming service, as we specified in the instructions. -
If the user wants to subscribe, the
recommend_movie
agent transitions the dialog to theSubscription
state. This state contains thesubscribe
agent.noteThe
recommend_movie
agent can transition the dialog to another agent, because therecommend_movie
has the Allow the agent to transfer the dialog to other agents in the script parameter enabled. For this parameter, possible transitions between agents are not displayed on the J‑Graph canvas. -
The
subscribe
agent offers various subscription options following the instructions.Parameters of the
subscribe
AI agent-
General settings:
- Agent ID:
subscribe
. - LLM:
gpt-4o
. - Agent role:
Streaming service employee
. - Agent goal:
Help the user subscribe
. - Instructions:
First offer a yearly subscription. Price for a year: $30. If the user doesn’t want that, offer a monthly subscription. Price for a month: $3. Once the user chooses a subscription, send a link for registration: example.com/year for a yearly subscription or example.com/month for a monthly subscription
.
- Agent ID:
-
History settings:
- Pass the bot dialog history to the agent: parameter enabled.
- Number of recent messages from the history:
50
.
-
Transitions to other states:
- Allow the agent to transfer the dialog to other agents in the script: parameter enabled.
- Next state if the agent achieved the goal:
Feedback
.
noteThe
subscribe
agent also has the Allow the agent to transfer the dialog to other agents in the script parameter enabled. If the user asks for a movie recommendation at any point in the dialog, the agent automatically transitions the dialog to theMovie
step. -
-
If the user has no more questions, the current agent transitions the dialog to the
Feedback
state.