> For the complete documentation index, see [llms.txt](https://docs.codewords.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codewords.ai/automations/building-an-ai-agent.md).

# Building an AI Agent

Step-by-step prompting guide to build a working AI agent with Cody. Real prompts from real conversations that produced production agents.

Building an AI agent sounds complex. On CodeWords, it’s a conversation. The trick is knowing **what to say** and **in what order**.

This guide gives you the prompts, tips, and patterns that have been used to build agents now running in production. You don’t have to use these exact words — Cody understands natural language — but these templates are battle-tested.

### The conversation flow

Every successful agent build follows the same five phases.

{% stepper %}
{% step %}
**Phase 1: Research (optional)**

Use this for complex agents with 4+ integrations, or when you’re not sure what architecture you need. Skip it for simple bots with 2–3 tools.

**What to say:**

> “Research the best approaches to build an AI agent that can \[your use case]. Look at OpenClaw, LangChain, and other frameworks, and tell me what architecture would work best on CodeWords.”

**What Cody does:**

* Searches documentation, GitHub repos, and technical articles
* Compares frameworks and approaches
* Recommends an architecture for your needs
* Flags challenges before you start building

**Example for a personal assistant:**

> “Research how to build a personal AI assistant that can manage my Google Calendar, read my Gmail, search the web, and remember things about me long-term. Compare approaches like OpenClaw’s architecture vs. a simpler tool-calling agent. What would work best on CodeWords?”
> {% endstep %}

{% step %}
**Phase 2: Context and requirements**

This is the most important phase. The more context you give Cody, the better your agent will be on the first try.

**Template — copy and customize:**

> “Build me an AI agent with these specs:
>
> **Platform:** \[WhatsApp / Slack / Telegram / API endpoint (paid plans)]
>
> **Tools it needs:**
>
> * \[Tool 1, e.g., Google Calendar — read and create events]
> * \[Tool 2, e.g., Gmail — read, summarize, and draft replies]
> * \[Tool 3, e.g., Web search — find current information]
> * \[Tool 4, e.g., Memory — remember facts I tell it]
>
> **Personality:** \[Brief and casual / Professional and detailed / Friendly but concise]
>
> **Memory:** \[Remember my preferences / Remember my team members / Remember project details]
>
> **Trigger:** \[Respond to WhatsApp messages / Run daily at 8am / Listen for Slack mentions]”

{% hint style="success" %}
**Pro tip:** Add a persona. For example: “Act like a sharp executive assistant who’s been working with me for years. You know I prefer morning meetings, hate unnecessary calls, and always want the TL;DR first.”
{% endhint %}

**What makes a great requirements prompt:**

* **Be specific about tools** — “Google Calendar” is better than “calendar”
* **Describe actions, not just access** — “read and create events” vs. “calendar access”
* **Set personality early** — it’s harder to change later
* **Mention your timezone** — agents default to UTC if you don’t specify. You can also set it in [Settings → Account](https://codewords.agemo.ai/#settings/profile) for scheduled workflows.
  {% endstep %}

{% step %}
**Phase 3: Build**

Once Cody understands your requirements, ask it to build. This is usually the shortest prompt.

**What to say:**

> “Build it. Deploy it as a new service called \[your-agent-name].”

**What Cody does:**

1. Creates the service code with your integrations
2. Configures tool connections (API keys, OAuth, webhooks)
3. Sets up memory
4. Tests each tool
5. Deploys to CodeWords cloud
6. Registers triggers (WhatsApp webhook, Slack events, schedule, and so on)

{% hint style="info" %}
**Naming tip:** Use descriptive, lowercase names with hyphens: `my-assistant`, `team-slack-bot`, `support-agent`. This becomes part of your service URL.
{% endhint %}

If Cody asks questions during the build, answer them — that usually means it found something unclear in your requirements.
{% endstep %}

{% step %}
**Phase 4: Test and fix**

Your agent is deployed. Test it, then tell Cody what to fix.

**What to say:**

> “I tested it and \[describe what happened]. Can you fix it?”

| Issue               | What to tell Cody                                                              |
| ------------------- | ------------------------------------------------------------------------------ |
| Wrong timezone      | “Calendar events show in UTC. I’m in \[your timezone].”                        |
| Responses too long  | “Keep responses under 3 sentences. Be more concise.”                           |
| Missing a tool      | “It can’t check my email yet. Add Gmail integration.”                          |
| Wrong personality   | “It’s too formal. Be more casual — like texting a friend.”                     |
| Trigger not working | “WhatsApp messages aren’t reaching the agent. Check the webhook registration.” |
| Memory not working  | “I told it my name yesterday but it doesn’t remember today.”                   |

{% hint style="info" %}
**Iteration is normal.** Most production agents take 3–5 rounds of testing and fixing. Each round usually takes under 2 minutes.
{% endhint %}
{% endstep %}

{% step %}
**Phase 5: Expand**

Once the core agent works, add more capabilities over time.

> “Add email drafting — when I say ‘reply to \[person]’, draft a response based on the conversation.”

> “Add a daily briefing — every morning at 8am, send me a WhatsApp message with my calendar, unread emails, and top tasks.”

> “Add image analysis — when I send a photo of a receipt, extract the total, date, and vendor.”

> “Add a weekly summary — every Friday at 5pm, summarize what I accomplished this week based on completed tasks and sent emails.”
> {% endstep %}
> {% endstepper %}

### Example prompts that work

These are real-world prompts (or close variations) used to build production agents:

| Goal                            | What to tell Cody                                                                                                                                                                                                              |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Personal WhatsApp assistant** | “Build me a WhatsApp AI assistant that checks my Google Calendar, reads my Gmail summaries, searches the web for current info, and remembers things I tell it. Keep responses short and casual — like texting a smart friend.” |
| **Team Slack bot**              | “Build a Slack bot for our #general channel that answers questions about our Notion docs, can search the web for current info, and creates Linear tickets when someone says ‘create ticket: \[description]’.”                  |
| **Customer support agent**      | “Build a WhatsApp customer service bot that answers questions using our FAQ document, creates support tickets when it can’t answer, and escalates to a human when the customer asks for one.”                                  |
| **Lead qualification bot**      | “Build a WhatsApp bot that qualifies leads by asking about company size, budget, timeline, and needs. Save qualified leads to a Google Sheet. Send me a Slack notification for hot leads.”                                     |

{% hint style="info" %}
**Notice the pattern:** Strong prompts include the **platform**, the **tools**, the **actions**, and the **personality**. The more specific you are, the fewer iteration rounds you’ll need.
{% endhint %}

### Tips from power users

**Do**

* **Start simple, then expand** — get a basic agent working with 2–3 tools, then add more
* **Be specific about tone** — “Respond like a busy CEO’s executive assistant” works better than “be professional”
* **Test with real scenarios** — don’t just say “hi”; ask it to check your calendar or search for something
* **Tell Cody about failures** — “It returned an error when I asked about tomorrow’s meetings” helps Cody debug faster

**Don’t**

* **Don’t over-specify technical details** — describe *what* you want, not *how* to build it
* **Don’t skip research for complex agents** — a few minutes of research can save a lot of rebuilding
* **Don’t try to build everything at once** — a focused agent with 3 solid tools beats a bloated one with 10 buggy ones
* **Don’t forget personality** — an agent that sounds robotic won’t get used, no matter how capable it is

### Start building

Open [CodeWords](https://codewords.agemo.ai/), start a new chat with Cody, and paste one of the templates above. Fill in your platform and tools, then iterate from there.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.codewords.ai/automations/building-an-ai-agent.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
