Integration Guide

Mental Model

Think of HUMA as an async, stateful API. You start by setting the parameters like HUMA personality, rules, and toolset.

Once HUMA is created, you can connect to it from your app. Usually your app has state - like conversation history in group chat, list of online users, or agent's hand in a card game.

State is a native term in HUMA. It's always available to HUMA. HUMA expects that you update the state in real time via Events.

These types of events are called Context Updates and consist of event description ("John sent message: Hello World!") and new state after this event happened (conversation history including John's message).

That's the primary way your app communicates with HUMA - via context updates.

HUMA communicates back via tool calls. Based on current context and recent events HUMA might decide to use one of the tools from its toolset.

HUMA tools differ from LLM provider tools - all HUMA tools are asynchronous. Calling a tool doesn't stop HUMA from processing new events, using tools and updating memory.

When you receive a tool call event, you should process it, and when it's ready send back result to HUMA. The asynchronous nature of all tools allows you to process tools for many seconds or even minutes without sacrificing real-time behavior.

Your App
State + Events
Context Updates
HUMA
Processing
Tool Calls
Your App
Execute + Respond

Example: Card Game with Group Chat

Imagine you want to implement a card game with group chat, with HUMA as one of the players.

1. Design Personality

Think about the personality you want HUMA to have. Is it competitive? Friendly? A trash-talker?

2. Describe the Rules

"You are playing Texas Poker. You can check, call, raise, or fold. The goal is to win chips..."

3. Design State

Design a state that contains all information a normal player would have - whose turn it is, what cards are visible on the table, what cards HUMA has in its hand, what is the stake, but also the conversation history of the group chat.

4. Send State Updates

Send state updates every time state changes - after every turn or player's action.

5. Design Tools (Actions)

Think about actions that agent needs to perform. In this case it might be "call", "check", "send_message", "pass". Your app is responsible for checking if it's agent's turn when these tools are called.

This is enough to implement HUMA-based agent for Texas Hold'em. The same pattern applies to any interactive application - games, chat platforms, assistants, and more.

Process of Designing HUMA Integration

1

Where to use HUMA

Decide where do you want to use HUMA. Common use cases include:

Characters in Games

NPCs, opponents, teammates

Virtual Assistants

Support, coaching, facilitation

Community Members

Chat participants, moderators

2

Design Personality

Think of the setting in which HUMA operates. Answer these questions:

What is the age of character they're playing?
What brought them into this situation?
What do they think about this whole situation?
What is their small goal they want to achieve?
What is a memorable event that happened to them today morning?
What is their background, country, family, dreams, and problems?
3

Design Rules

This is how HUMA should behave in this specific scenario. It might include:

  • Description of the task
  • Rules of the game
  • Guidelines and constraints
  • Expected behaviors and responses
4

Design State

What information from your app should agent have? The easiest way to design the state is to imagine you put a human in the place of HUMA - what should be in the UI of human user?

Think like a human player. What would they see on their screen? That's your state.

This can include chat message history, presence status of users, game state available to agent, description of game scene.

5

Note the State Changes

Each update to state is passed to HUMA as Event. These events keep state up-to-date and potentially trigger response from HUMA.

Your app must implement the state and state updates, with each update passed to HUMA. See Agent Lifecycle for details on how events flow.
6

Design the Tools

Tools correspond to actions agent can take. All tools are asynchronous, which means that running a tool doesn't stop HUMA from processing new events.

Example tools include:

send_messageweb_searchrun_programplay_cardmake_moveschedule_reminder
7

Pick the Right Router

Router is a component that guides HUMA's behavior. Available router types are:

RouterBest For
llm-judgeGeneral purpose, context-aware responses (default)
conversationalChat-based apps with timeliness scoring
turn-takingMulti-agent voice conversations
voice-gameVoice game scenarios
randomTesting, fast (no LLM call)

For example, if your app is primarily chat-based, use the conversational router. If it's a game bot, use llm-judge router.

Next Reads