Build agents

Teams

One agent is useful. A few of them working together is something else. Put your agents in a team and they share a single chat: you post a request, the right agent picks it up, and when the job needs someone else, the agents hand the work to each other while you watch. It feels less like using software and more like messaging a team of colleagues who never sleep.

How a team works

Every team has a lead and a few members, all of them agents you have already built. Together they get a team chat, one conversation where you and the whole team talk.

  • You decide who does the work. Mention an agent with @ and it replies. Mention two and they reply in the order you named them. Mention nobody and the lead picks it up.
  • Agents pass work along. A member can mention another member to hand over the next part of the job, and that agent carries on from there.
  • Each member has its own workspace. An agent does its actual work, the thinking, the tool calls and any approvals, in its own work thread. Only its finished reply is posted to the team chat, so the chat stays readable while every step stays one click away.

Say you run a small blog. You could have a market scout that tracks the news, a writer that drafts posts, and a publisher that puts them live. Post "@Market Scout find this week's big story and pass it to the writer" and watch the chat fill in as the job moves from one agent to the next.

Create a team

Open Teams under Build in the sidebar and choose New team. Give it a name, tick the agents that belong in it, and pick the lead. That is all a team needs. You can also set a handoff limit and a schedule here, or come back to them later in the team's Settings.

Open the team afterwards to shape how each member shows up. Edit a member to give it:

  • A title, such as "Billing specialist", shown beside its name in the chat.
  • An avatar, picked from your media library or uploaded on the spot.
  • A reporting line, so you can record who reports to whom.
Workspace admins create and change teams. Everyone else in the workspace can still see every team, open its chat and start a run.

A few rules

  • One team per agent. An agent that is already in a team isn't offered for another one.
  • Names must be different. Mentions go by name, so no two members of a team can share a name, even with different capital letters.
  • The lead stays. To remove the lead, make a different member the lead in Settings first.
  • The built-in assistant isn't a member. It can set teams up for you, but it can't join one.

Talking to the team

Choose Open team chat on the team's page. The chat lives in Conversations alongside everything else, marked with a group icon and titled with the team's name.

Type @ in the message box and a list of the team's members pops up, so you never have to remember exact names. Names with several words work fine. Every mention of a member shows in bold, in your messages and in the agents' replies, which makes it easy to see at a glance who was asked to do what.

There's no need to wait for an answer before sending the next message. Agents reply one at a time, and anything you post while they are busy simply waits its turn.

When agents hand work to each other

Handing work along is the best part of a team, and it needs a sensible limit so two agents can't bounce a task between them forever. The agent handoff limit (3 by default) caps how many times agents can pass work to each other after a person posts. When they reach it, the chat shows "Stopped after 3 handoffs between agents. Reply in the chat to continue." Your next message starts the count again.

Set the limit to 0 if you only want agents to answer people. They will still reply when you mention them, but they won't trigger each other.

Following the work

A strip of members sits under the chat's header, showing what each agent is up to right now. A small spinner means the agent is working, and a Waiting tag means it needs a person before it can go on. Click any member to open its work thread.

A work thread is where you can watch an agent think: its reply forming live, every tool it calls, and any approval card it is waiting on. You can't post into a work thread, since the team chat is where the talking happens, and each one has a link straight back to it. Replies in the team chat carry a Work thread link too, so you can check how any answer was put together.

When the lead works through a task with several steps, its checklist appears in the team chat as the Team board, ticking off as the work gets done.

Stop in the chat's header halts the reply in progress and clears everything still waiting its turn. A question a member has already asked you stays open, and answering it later still gets you that member's reply.

When a member needs you

Members follow the same rules as any agent, so a tool that needs a sign-off still asks for one. When a member stops to wait on a person, the team chat tells you straight away, for example "Billing Agent is waiting for a person before it can reply: which invoice should I refund? Answer it in the review queue." Choose Open review queue on that notice to answer it. The approval card is also in the member's work thread.

Once you answer, the member finishes the job and posts its reply in the team chat as usual. If the question belongs to another agent the member asked for help, the notice still tells you someone is waiting, but leaves the question itself out.

Two other notices can appear in the chat. One tells you a member's agent was switched off and can't reply, and the other tells you a member's reply failed.

Run the team on a schedule

A team doesn't have to wait for you. In the team's Settings, choose a Schedule (hourly, daily, weekly, or a custom cron timetable in UTC) and write the run message each run should post. The editor previews the next few run times, and the team's page shows when the next one is due.

A run message is posted into the team chat just like your own message would be. Mention agents in it to decide who starts, or leave mentions out and the lead takes it. So "@Market Scout gather this week's news and hand it to @Writer for a summary" becomes a weekly routine that runs itself, and you read the result over coffee.

Want a run right now? Choose Run now on the team's page. You can add instructions for this run only, and they are posted under the run message. If the team has no run message yet, your instructions are posted on their own. Anyone in the workspace can start a run, and the team chat opens so you can watch.

Messages posted this way are easy to spot in the chat: they show as Scheduled run or Run now with the name of whoever started it.

Posting from an agent's own chat

Sometimes an agent you are chatting with one-on-one has something the whole team should see. When its reply mentions the team with @ and the team's name, that message is also posted into the team chat. It carries a From its chat link back to the conversation it came from, and nothing changes in the original chat.

Bring the team into Slack

A team can live in a Slack channel as well as in Hania. People post in the channel, and each agent answers there under its own name and title, with its avatar, so the team feels like part of your Slack workspace. Notices, such as a member waiting on a person, show up in the channel too.

  1. Connect your Slack workspace first, under Channels in the dashboard. See Messaging channels. When it connects, Hania gives you a Request URL, the same one you paste into your Slack app's Event Subscriptions. You'll use it twice more below.
  2. In your Slack app, subscribe to the message.channels event (scope channels:history), or to message.groups (scope groups:history) for a private channel. Add the bot scopes chat:write, chat:write.customize, users:read, and commands.
  3. Create a slash command called /team and set its Request URL to that same Request URL.
  4. Turn on Interactivity & Shortcuts and use the same Request URL there too.
  5. Reinstall the app so the new scopes and settings take effect.
  6. Invite the app to the channel you want the team in.
  7. On the team's page, pick the Slack workspace, paste the channel ID (it looks like C0123456789), and choose Link channel.

That's it. In the linked channel, type /team to pick the members you want and send them a message, right from Slack.

One Slack channel can belong to only one team.

Removing members and deleting a team

Removing a member takes it out of the team and deletes its work thread in that team. The agent itself is untouched and can join another team.

Deleting a team deletes its team chat and every member's work thread. The agents and their memories are kept.

Deleting can't be undone. The usage from those conversations also disappears from Analytics and Insights. Your billing totals are unaffected.

Behaviors & gotchas

  • Team conversations belong to the team. You can't delete, edit or regenerate a message in a team chat or a work thread on its own. They go when the team goes, and a bulk delete that includes them simply leaves them in place.
  • The assistant can manage teams for you. Ask the Hania Assistant to set up a team or start a run. It always asks your permission before deleting a team or removing an agent from one.
  • Teams and delegation are different. Delegation is one agent quietly asking another for help in the middle of its own task. A team is several agents working in the open, in a chat you can see and join.