0Pricing
AI Agents · Lesson

Prompts, Roles and System Messages

Use system, user, and assistant roles to shape agent behavior, and learn how persona and instructions live in the system prompt.

Prompts, Roles and System Messages is a free AI Agents lesson on CoddyKit — lesson 2 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AI Agents learning path, one of 3 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Talking to the brain

You steer an LLM with a prompt: the text you send it. Clear prompts get clear answers. It's that direct!

Prompts as instructions

Think of a prompt like a recipe. The clearer your steps, the better the dish that comes out. 🍳

Messages have roles

In a chat, each message has a role. The three you'll meet most: system, user, and assistant.

The system role

The system message sets the rules and personality up front, like a job description handed to your intern before they start.

The user role

The user message is you: your question or request. This is the actual task you want done right now.

The assistant role

The assistant message is the LLM's reply. The chat keeps growing as the two of you go back and forth.

See it in code

Here's the shape of a chat in plain Python. Notice the roles and content, super simple!

messages = [
  {"role": "system", "content": "You are a friendly tutor."},
  {"role": "user", "content": "Explain agents simply."}
]
print(messages[0]["role"])

Why system matters

A good system message keeps the agent on track and in character across the whole conversation. It's your steering wheel.

Be specific

Vague in, vague out. Tell the model who it is, the goal, and the format you want. Specifics are your superpower. ✨

Nicely done! 🎉

You can now shape an agent with roles and a system message. Next: how agents actually take action with tools.

Quick Check

Quick one! Which message sets the agent's rules and personality up front?

Frequently asked questions

Is the “Prompts, Roles and System Messages” lesson free?

Yes — the full text of “Prompts, Roles and System Messages” is free to read here on the web, and the AI Agents course includes 3 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AI Agents course, upgrade to CoddyKit PRO.

What will I learn in “Prompts, Roles and System Messages”?

Use system, user, and assistant roles to shape agent behavior, and learn how persona and instructions live in the system prompt. You practise AI Agents with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start AI Agents?

No prior experience is required. AI Agents on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 3, so you can start here or from the beginning and move at your own pace.

How long does the “Prompts, Roles and System Messages” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this AI Agents lesson?

Yes. Every AI Agents lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What Is an LLM-Based Agent?
  2. Prompts, Roles and System Messages
  3. Tool Use: How Agents Take Action
← Back to AI Agents