Sending Messages

What you'll accomplish: Send messages to agents via interactive chat, the REST API, and channels.

An agent must be Running (see Agent lifecycle) to accept a message.

Interactive chat

hoziron-cli agent chat <agent-id>

Opens a persistent chat session with the given agent. There is no default agent — the platform ships empty and inert, so an ID is always required. Type messages, get responses. Ctrl+C to exit.

One-shot messages (scripting)

There's no dedicated one-shot CLI command; use the REST API directly (see below) for scripting and automation.

REST API — send

curl -X POST http://localhost:4200/agents/{id}/send \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer hzk_..." \
  -d '{"message": "How many open claims do we have?"}'

The request body is {"message": "<text>"} — note the field name is message, not content.

REST API — structured invocation

For workflow-driven or programmatic calls that need an InvocationContext (source, correlation, idempotency key) rather than a plain chat message, use /invoke instead:

curl -X POST http://localhost:4200/agents/{id}/invoke \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer hzk_..." \
  -d '{"input": "New claim: auto collision on 2024-06-01...", "source": "Api"}'

/send is the simple chat-style path; /invoke is what workflow steps and triggers use under the hood.

Channels (Slack, Teams)

Set up a channel bridge:

hoziron-cli channel setup slack

Once configured, agents respond to messages in the connected channel.

Session management

Each agent maintains its own conversation history. To reset:

curl -X POST http://localhost:4200/agents/{id}/session/reset \
  -H "Authorization: Bearer hzk_..."

To clear history entirely:

curl -X DELETE http://localhost:4200/agents/{id}/history \
  -H "Authorization: Bearer hzk_..."

Multi-context access

If you manage multiple Hoziron instances:

# Add contexts
hoziron-cli context add production --url https://hoziron.prod.internal --auth local --api-key-env HOZIRON_PROD_KEY
hoziron-cli context add staging --url https://hoziron.staging.internal --auth none

# Switch context
hoziron-cli context use production

# Or per-command
hoziron-cli --context staging agent chat my-agent-id

Next steps


Related: