Sona Quickstart
Five minutes from a fresh shell to a Telegram message round-tripping through your own agent. You need:
- macOS, Linux, or WSL on x64 or aarch64
- An LLM API key — Anthropic, OpenAI, Google, or a local Ollama
- A Telegram account (the bot is free; no card on file)
You do not need Java pre-installed — the installer bundles a JRE if you don't already have Java 21+ on your PATH.
1. Install (30 seconds)
curl -fsSL https://tnsai.dev/install/sona.sh | bashThis drops the JAR into ~/.sona/, bundles Eclipse Temurin JRE 21 if your system Java is \< 21, writes a config template, and puts sona on your PATH.
Verify:
sona --versionYou should see the current version + the JRE path.
2. Get a Telegram bot token (90 seconds)
In Telegram, open a chat with @BotFather:
/newbot- Pick a display name (e.g.
My Sona) - Pick a username — must end in
_bot(e.g.my_sona_bot) - Copy the token BotFather sends back. It looks like
123456:ABC-DEF....
3. Run sona init (90 seconds)
sona initThe wizard asks for, in order:
| Prompt | What to paste |
|---|---|
| LLM provider | anthropic, openai, google, or ollama |
| Model | e.g. claude-sonnet-4-20250514, gpt-4o, gemini-2.0-flash, llama3.1 |
| API key | Your provider key (or blank if you'd rather use $ANTHROPIC_API_KEY etc.) |
| Telegram bot token | The string from step 2 |
The wizard writes ~/.sona/sona.yml, then runs a health check (LLM ping + Telegram getMe). If both pass you're ready.
4. Start the daemon (30 seconds)
sonaThe first time you run it, the daemon will log a banner like:
TnsAI Sona v0.3.0
Workspaces: 1
Channels: 1The process stays running in the foreground. Open another terminal for the rest of this guide; sona stop shuts it down.
5. Send your first message (60 seconds)
Open your bot's chat in Telegram (t.me/<your_bot_username>) and send anything — hi.
Sona replies with a pairing code because it doesn't know you yet:
You: hi
Bot: Hi! I don't recognize you yet. Please share this pairing code
with my owner to get access: 483921You are the owner, so approve yourself from another terminal:
sona pair list # show pending requests
sona pair approve 483921 # by code(sona pair approve telegram:<your_telegram_user_id> also works if you'd rather skip the code.)
Send another message:
You: Summarize what TnsAI is in one paragraph.
Bot: TnsAI is a modular Java framework for building AI agents…That's it — your daemon is processing a message, dispatching to an LLM, and replying through the Telegram adapter.
What just happened
Three TnsAI modules carried the round-trip:
tnsai-channels— TheTelegramAdaptertranslated an incoming Telegram update into aUnifiedMessage.tnsai-core— The session'sAgentran one BDI cycle: pulled belief state from the session, picked an action, called the LLM throughtnsai-llm, streamed the reply back.tnsai-channelsagain — The adapter rendered the agent'sUnifiedResponseas a Telegram message.
Sona's only job is the routing in the middle: workspace selection, session lookup, pairing-policy enforcement, audit log. See How It Works for the full picture.
Next steps
- Talk to it from a terminal instead —
sona chatopens a local REPL (JLine, streaming, slash commands). Add--jsonfor newline-delimited JSON suitable for piping. - Tail the logs —
sona logs -ffollows~/.sona/sona.login real time.sona logs --grep ERROR -ifor case-insensitive filtering. - Add tools — Sona ships with all 62
tnsai-toolsPOJO toolkits available. Toggle a per-user allowlist in~/.sona/sona.ymlunderworkspaces.<name>.tools. - Add MCP servers — Drop a
mcp_servers:block insona.ymland Sona will register them throughtnsai-mcpat start-up. - Point a workspace at a project — Set
project_diron a workspace and Sona auto-loadsAGENTS.md(falling back toCLAUDE.md/README.md) from that directory into the agent's system prompt at session boot. See Project context below. - Drive Sona from a script — Every command takes
--jsonand emits the same envelope. See the machine-readable mode reference. - Stop —
sona stop(SIGTERM) orsona stop --force(SIGKILL). - Uninstall —
sona uninstall --yesremoves~/.sona/and thesonalauncher.
Project context via AGENTS.md
When a workspace's project_dir points at a code repo, Sona reads that repo's AGENTS.md (agents.md spec) at session boot and augments the workspace's system_prompt with the parsed intro + sections. The operator's prompt always leads; the project context is appended, never substituted.
# ~/.sona/sona.yml
workspaces:
code:
system_prompt: "You are a coding assistant."
project_dir: "/Users/me/repos/my-project" # opt-inFallback order is AGENTS.md → CLAUDE.md → README.md (with lowercase + dot-prefixed variants). If none exist, the system prompt is unchanged — session boot never fails because of a missing or malformed context file. Project context is opt-in: a workspace without project_dir boots byte-for-byte the same as before (same role body, same agent principal id).
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
sona init says "LLM health check failed" | Wrong key, wrong model name, or no network | Re-run sona init and double-check the key |
sona init says "Telegram getMe failed" | Wrong bot token or token revoked | Re-issue via BotFather /token, re-run sona init |
| Bot doesn't respond at all | Daemon isn't running, or another instance has the bot token | sona status to check; only one daemon can poll a token at a time |
command not found: sona | Installer couldn't write to your PATH | Re-source your shell rc (source ~/.zshrc) or add ~/.local/bin to PATH |
| Pairing code reply but approval doesn't take effect | Code typo, or daemon restarted between issue and approve | Send a fresh message; a new code is issued, then approve that one |
For deeper digging, see the Sona repo's README — it's the authoritative reference and tracks command changes as they ship.