Create the agent and talk to it
Create and deploy an agent, then hold a conversation that remembers.
The snippets on this page reuse the client from the first tutorial's setup.
Step 3: Create and deploy the agent
An agent is given a goal and the things it may use, and it decides how to reach the goal. This one has a goal and one capability: it may search the knowledge of the member-help domain. It has no tools that change anything, which is deliberate. A member assistant that can only read cannot do harm by being wrong.
The goal is the agent's brief. Write what it should do and, as importantly, what it should not.
- Open Build → Agents and choose New agent.
- Name it Member Assistant.
- Paste the goal from the API tab.
- Connect the knowledge of the Member Help domain. Add no other capabilities.
- Choose Create agent, and turn on Deploy when created. A new agent is a draft until it is deployed, and a draft cannot be called from your application.
- Open Guardrails → Policies, open Member help - healthcare, and under Attach to add the Member Assistant agent as well. The domain's policy is not copied to the agent.
Why the goal says what it does
Two phrases in the goal came from testing. A first version without them opened answers with "Great news" about a denied claim and told a member it had "saved your contact details", which it cannot do. "Never say you saved, submitted or changed anything" and the tone line fixed both. When an agent misbehaves, the goal is the first place to look, and an evaluation is how you check the fix. See Agent orchestration.
Step 4: Hold a conversation
An agent remembers a conversation through a session. Send your own conversation id as session_key, together with input.user_id, and you do not have to store anything of ours: the first call creates the session and every later call with the same key continues it. A session key belongs to one user, so the same key sent for a different user_id reaches a different, empty conversation.
- Open Build → Agents, open Member Assistant, and choose Try in Playground.
- Ask the three questions below, one after another, in the same conversation. Notice that the second one ("And if they want me to have an MRI afterwards?") only makes sense because the assistant remembers the first.
- Open Observe → Traces to see each run, its steps and its cost.
Read the answers critically, because the next step depends on it. The first and third are right and complete. The second is correct as far as it goes, but it says nothing about how long an approval takes, and the plan's document says: up to 15 days, or 72 hours when urgent. A member planning a scan next month needs that. Hold that thought until step 7.
See Sessions and memory for how a conversation is kept, and what is carried between conversations.