Homework 4

Give your agent an inbox, and subagents

Due before class on Wednesday, October 28, 2026

Email is the oldest way for agents to talk: an address, an inbox, messages that wait until they're read. This week your agent gets its own Gmail address and an email MCP server, packaged as a plugin, says hello to the class's agent, and learns to hand work to subagents: copies of its own loop that it starts, talks to and stops.

Added October 23: part 4, subagents. Already sent your hello? Keep going from part 4; it goes in the same pull request.

Missed week 2 or 3? That's fine. Build the email plugin and use it from an agent you already have (Claude Code, Codex or OpenClaw). But building on your own agent loop teaches you considerably more, so if you can, build your harness too.

Start

  1. Open an AI coding agentClaude Code, Codex, Cursor, GitHub Copilot, … in your harness folder.
  2. Give it this Read https://class.xhelio.ai/week-4/homework.md and help me with my homework.
  3. Build it togetherIt helps you set up the account, builds the server and the plugin with you, connects it to your agent, sends the hello, builds the subagents with you, and opens your pull request.

Parts 1–3: an inbox

The hello

Subject: [AIR-2026 hello] <your-github-username>

class: AI in Research 2026
github: <your-github-username>
agent: <your agent's name>
harness: <your harness repo, or the agent you use>
model: <the model it runs on>
plugins: telegram, <research plugin>, email
research: <one sentence on your research>
reply-to: <your agent's Gmail address>

<A note written by your agent itself, at most
100 words: who it is, and what it can do
for your research.>

Fields first, one per line, so the class agent can read them. Send it once.

Part 4: subagents

A subagent runs your agent's own loop with a fresh conversation: its own system prompt, the task it was given, and its own tools. The main agent never sees its work, only its report. Each kind is a file agents/<name>.md, as in Claude Code: a name, a description, its tools, max_turns, and a body that is its system prompt.

delegate(agent, task)       hand over: run it, wait, return its report

subagent(action, …)         run in the background, control the lifetime
  start  agent, task        start one; return its id (sa-3) at once
  list                      id, type, state, turns, tokens, time running
  send   id, message        message it; an idle one wakes up and goes on
  wait   ids, timeout       wait until they finish; return their reports
  read   id, last           its last steps, without stopping it
  stop   id                 stop it now, killing a running command

states   running → idle (report ready) → running again on send
         ends as stopped (stop, or session end) or failed (error, limits)

What you submit

A pull request adding week-4/submissions/<your-github-username>/: your email plugin folder <you>-email/, your agent type files in agents/, the five demos in transcripts/, and a README.md linking to your harness (or naming the agent you used), saying when your agent sent its hello, and how your subagents run.

It counts when the plugin works in your agent, the hello arrived in the format above, your agent read the class agent's reply, your harness has delegate and subagent with the six actions and the rules, the five demos work, and no password is committed. Say in your pull request which AI helped you, and how.