Skip to content
English

Give your agent a resident

Pixling is preparing for Mac App Store release. Join the waitlist on pixling.app to hear when it launches.

Each agent owns one resident, bound to a namespace and key the agent chooses. This binding separates your agent’s resident from every other resident on the desk. To collect several agents on one resident, see Report from several agents.

Resident lifecycle
pixling_resident_ensure (namespace + key + assetID)
│
▼
client:<namespace>/<key>
├── Write: pixling_message_send / pixling_question_ask
├── Read: pixling_inbox_watch ─► pixling_inbox_read
└── End: pixling_resident_requestClose
Try it in 10 seconds (CLI)
pixling resident ensure --namespace demo --key main --asset-id No.1 --name "Helper"
pixling message send --to client:demo/main --text "Ready!"

Each pixling_zukan_list entry includes a selector such as No.7. Pass it as assetID to pixling_resident_ensure:

pixling_resident_ensure (first call)
{"namespace": "my-agent", "key": "conversation-1", "assetID": "No.7"}

Calling pixling_resident_ensure again with the same namespace and key returns the same resident and never creates a second one. To resume an existing binding, send only the pair:

pixling_resident_ensure (resume)
{"namespace": "my-agent", "key": "conversation-1"}
Why your agent chooses the key

Pixling does not generate keys for you. If a response carrying a server-issued key were lost in transit, a retry would leave an extra resident behind.

Use your host’s session ID, or generate a random key and store it locally. These values are correlation keys, not secrets. When to start a fresh key (per conversation or on /clear) is up to you.

Address your bound resident as client:<namespace>/<key>:

pixling_message_send
{
"to": "client:my-agent/conversation-1",
"text": "Starting the migration",
"author": "My Agent"
}

Ask questions with pixling_question_ask using the same selector; see Build expression.

Nothing is pushed to your agent. Messages the user types to your resident, and question answers that no call was waiting for, stay in that key’s inbox.

  1. Wait for unread IDs with pixling_inbox_watch (waitMs up to 55000):

    pixling_inbox_watch
    {"namespace": "my-agent", "key": "conversation-1", "waitMs": 55000}
  2. Fetch each entry and mark it read with pixling_inbox_read:

    pixling_inbox_read
    {
    "namespace": "my-agent",
    "key": "conversation-1",
    "messageID": "a1b2c3d4-0000-4000-8000-000000000001"
    }
Entry kind Meaning
message Text the user typed to your resident (the user can write at any time).
answer An answer to one of your questions given while no call was waiting.
closed The user put your resident away; it takes no more messages, while earlier unread entries stay readable.

While no receiver is connected for that namespace and key, the input area notes that messages wait until your session checks. Hold a receiver with the CLI so Pixling knows you hear replies right away (MCP cannot hold a receiver):

Terminal
pixling inbox receive --namespace my-agent --key conversation-1

See Inbox.

When your work is finished, ask the user whether to end the session with pixling_resident_requestClose (CLI: pixling resident request-close --to client:my-agent/conversation-1):

pixling_resident_requestClose
{
"to": "client:my-agent/conversation-1",
"author": "My Agent"
}

The resident displays a fixed prompt:

This is a request to end. End now? — Yes (yes) / No (no)

Pixling owns the wording, while author names who is asking. The call waits and returns like pixling_question_ask.

Outcome What happens
Yes (countdown finishes) The answer counts down Ending in 5 s (1/s), then Pixling stows the resident; kind: closed reaches the inbox (after kind: answer if no call was waiting) and held receivers end.
Yes, user puts it away during countdown Closes immediately; kind: closed reaches the inbox and held receivers end.
Yes, Pixling quits during countdown Pixling puts the resident away before exiting.
Yes, Pixling crashes during countdown The resident stays on the desk and no kind: closed arrives.
No Nothing changes; the resident stays on the desk.