Quick Start
Get up and running with the AdaL Agent SDK in minutes.
Installation
pip install git+https://github.com/SylphAI-Inc/adal-sdk.git
For local development:
git clone https://github.com/SylphAI-Inc/adal-sdk.git
cd adal-sdk
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Prerequisites
Before using the SDK, ensure:
- AdaL CLI is installed — run
adal --versionto verify. If not installed, see the CLI Quickstart - Authentication is complete — see below
- Python 3.10+ — run
python --versionto verify
Authentication
The SDK supports two authentication methods:
Option 1: Cached credentials (recommended)
Run adal once and complete browser sign-in. AdaL stores your credentials at ~/.adal/adal_oauth_creds.json. The SDK picks these up automatically — no extra configuration needed:
options = AdalAgentOptions(workspace=".")
Option 2: Explicit token (headless / CI)
Pass a JWT directly via auth_token to bypass cached credentials. Copy the value of the access_token key from ~/.adal/adal_oauth_creds.json:
cat ~/.adal/adal_oauth_creds.json | python3 -c "import json,sys; print(json.load(sys.stdin)['access_token'])"
options = AdalAgentOptions(
workspace=".",
auth_token="<paste access_token here>",
)
This is useful for CI/CD pipelines or environments where running adal interactively isn't possible.
Your First Query
The simplest way to use the SDK is the query() function:
import asyncio
from adal_agent_sdk import AdalAgentOptions, query
async def main():
async for event in query(
prompt="Summarize this workspace in three bullets.",
options=AdalAgentOptions(
workspace=".",
permission_mode="yolo", # auto-approve all tools
),
):
event_type = event.get("type")
if event_type == "assistant.message.completed":
# The complete assistant reply — this is the answer you display.
# An agent may emit this more than once per turn; concatenate them.
print(event.get("message", {}).get("content", ""))
elif event_type == "command.completed":
print("✓ Done")
elif event_type == "command.failed":
print(f"✗ {event.get('error', {}).get('message', 'unknown error')}")
asyncio.run(main())
Save this as my_first_query.py and run:
python my_first_query.py
Understanding Events
The SDK streams events as dictionaries. Parse each event and switch on its
type field. Key event types:
| Event Type | Description |
|---|---|
assistant.message.completed | A complete assistant reply — the answer you display. May occur more than once per turn (e.g. text before and after a tool call); concatenate them. |
thought.delta | An incremental chunk of the agent's reasoning/thinking. Chunks sharing a thoughtId concatenate. |
tool.started | The agent invoked a tool (name, args, toolCallId). |
tool.completed | A tool call finished (status, result, toolCallId matching tool.started). |
command.progress | A transient human-readable status line (e.g. "Syncing workspace"). Safe to show as ephemeral progress. |
ui.message.appended | A surfaced notice from the runtime (message.level is info / warn / error). |
command.completed | The turn finished successfully. The stream closes next. |
command.failed | The turn errored (a mid-stream failure, since HTTP already returned 200). |
For a minimal integration you only need assistant.message.completed (the
answer) and command.failed (errors) — the rest drive live UI.
Choosing a Permission Mode
| Mode | Behavior |
|---|---|
"yolo" | Auto-approve all tool calls (best for scripts/CI) |
"acceptEdits" | Auto-approve reads, prompt for writes |
"default" | Prompt for all tool calls via can_use_tool callback |
For automation, use "yolo". For controlled execution, use "default" with a permission callback. See also: Built-in Tools for the full list of tool groups and permission modes.
Tool Permissions
Control which tools the agent can use:
Enabling / Disabling Tools
Use enabled_default_tools (positive set) or disabled_default_tools (negative set) to control which built-in tools the agent can see and call. Disabled tools are absent from the agent's prompt entirely.
# Positive set: agent can ONLY use these tools
options = AdalAgentOptions(
workspace=".",
enabled_default_tools=["Read", "Search", "Bash"],
permission_mode="yolo",
)
# Negative set: disable specific tools
options = AdalAgentOptions(
workspace=".",
disabled_default_tools=["Web", "Video", "Image"], # no web access or media generation
permission_mode="yolo",
)
Accepts tool groups ("Bash", "Edit", "Read", "Search", "Web",
"Image", "Video", "Consult") or exact tool names ("web_search"). Scope is
built-in core tools only; custom tools are unaffected.
For the full tool group reference and CLI equivalents (--enabled-default-tools / --disabled-default-tools), see the Built-in Tools guide.
Selecting a Model
Specify a model at startup:
options = AdalAgentOptions(
workspace=".",
model="claude-sonnet-4-6",
permission_mode="yolo",
)
See the models list for available model slugs.
Custom System Prompt
Override the default agent system prompt with your own instructions from a file:
options = AdalAgentOptions(
workspace=".",
prompt_file="./my_prompt.txt",
permission_mode="yolo",
)
The file contents replace AdaL's built-in role prompt, letting you tailor the agent's persona, constraints, or focus area for your use case. This is equivalent to the --prompt-file flag in the CLI. For the full guide on AGENTS.md and --prompt-file, see Custom System Prompt.
Custom Runtime Path
If AdaL is installed in a non-standard location:
options = AdalAgentOptions(
workspace=".",
runtime_path="/opt/adal/bin/adal",
)
Or set the environment variable:
export ADAL_RUNTIME_PATH=/opt/adal/bin/adal
What's Next
- Client API — multi-query sessions and advanced control
- Permissions — fine-grained tool approval
- API Reference — full module reference
- Built-in Tools — full tool group reference and recipes
- Custom Tools — add your own Python tools via
.adal/tools.py - Custom System Prompt —
AGENTS.mdand--prompt-file - CLI Quickstart — install and use the AdaL CLI
- Models — available AI models