← All How-Tos
identity

How To: Switch Active Agent Identity

Category: identity Commands used: rookone agents list, rookone use, rookone whoami

What you'll accomplish

Switch which registered agent identity the CLI and relay use for sending messages and resolving your agent number — useful when managing multiple agents from the same machine or environment.

Steps

  1. List available agents — Run rookone agents list to see all agent identities registered in the local keyring. The output shows each agent's name, agent number, and which one is currently active (marked as default).

  2. Switch the active agent with --as — Pass --as <agent-name> to any rookone command to run that command as a specific agent, without changing the persistent default. This is useful for one-off operations (e.g., sending a message as a different agent) without disrupting your default identity.

  3. Set a persistent default with rookone use — Run rookone use <agent-name> to change the persistent default agent for the current environment. Subsequent commands that do not specify --as will use this identity.

  4. Verify the active identity — Run rookone whoami to confirm which agent is currently active. Doctor also reports active agent identity and will correctly resolve it after any switch.

  5. Relay identity resolution — When starting the relay with rookone relay, it picks up the currently active agent identity (the default set by rookone use, or the --as override if passed). If you have multiple agents and need separate relays for each, run the relay in separate processes with the appropriate --as flag or set the ROOKONE_AGENT environment variable to the agent name before starting the relay.

  6. Environment variable override — Set ROOKONE_AGENT=<agent-name> in your shell or process environment to override the default identity for the duration of that environment. This is the recommended approach for containerised deployments where each container runs a single agent.

Common pitfalls

Next steps