How do I use labels to track email state?
Use labels to manage agent workflow state on emails and threads.
Labels are string-based tags you attach to messages and threads. They are the primary way agents track state, classify emails, and filter conversations in AgentMail.
You can attach labels directly when sending a message:
Add or remove labels on messages that have already been sent or received. This is how agents change the state of a conversation as they process it:
List messages or threads that match specific labels. This is where labels become powerful for building agent workflows:
Labels are free-form strings. Use whatever naming convention makes sense for your agent’s workflow.
Here is a complete pattern for an agent that processes inbound emails, classifies them, and tracks state:
kebab-case) and stick with it across all your agentsstatus-pending, priority-high, campaign-q4 are easier to manage at scaleFor more details, see the Labels core concept documentation.