Idun SDK
Thin, stdlib-only client + CLI for the NatureLM-Idun-5-MoE agent on Azure AI Foundry — with a pluggable multi-backend layer.
Runs headless on Termux/Android with nothing but the Python standard library
(no httpx, no azure-identity, no Flask). Idun is a tool agent (reasons +
calls tools like web_search); this SDK surfaces the full agent trajectory
(reasoning + tool calls) instead of a black-box answer.
Multi-backend
The same IdunClient API dispatches to four interchangeable backends. Non-Azure
backends need no FOUNDRY_TOKEN, so the SDK keeps working even when the Azure
subscription is suspended.
| Backend | Credentials | Cost | Notes |
|---|---|---|---|
azure |
Entra device-code (idun login) |
paid | default; full tool-agent trajectory |
hf |
HF_TOKEN / ~/hf_token.txt |
free | Hugging Face Inference API; flat answer |
github |
GITHUB_TOKEN / ~/github_token.txt |
free | GitHub Models (OpenAI-compatible) |
ollama |
local server at OLLAMA_BASE |
free | no cloud; set OLLAMA_MODEL |
Set the backend globally via env (IDUN_BACKEND=hf) or per-call (--backend).
Model overrides: HF_MODEL, GITHUB_MODEL, OLLAMA_BASE, OLLAMA_MODEL.
Non-Azure backends return a flat answer (res.steps == []) — the tool-agent
trajectory is an Azure-Idun feature.
Install
pip install idun-sdk
Installs the idun CLI, the idun Python package, and the stdlib MCP server
idun_mcp.py. Requires Python ≥ 3.8; no third-party dependencies
(stdlib-only, runs headless on Termux/Android).
Verify the install:
idun --help # shows all commands
idun welcome # banner + matrix intro
Setup
Idun is backend-agnostic. Pick a backend once with the wizard (writes
~/.idunrc, sourced automatically by your shell), or set credentials per
backend. Run the wizard for a guided, universal first-run setup:
idun wizard # choose backend, capture creds/config -> ~/.idunrc
source ~/.idunrc # or restart your shell
idun status # confirm active backend + credential state
Backend credentials
| Backend | Setup command | Stored at / env |
|---|---|---|
azure |
idun login |
~/foundry_token.txt |
hf |
idun login --backend hf |
~/hf_token.txt / HF_TOKEN |
github |
idun login --backend github |
~/github_token.txt / GITHUB_TOKEN |
ollama |
start a local server, set OLLAMA_BASE |
env OLLAMA_BASE / OLLAMA_MODEL |
Azure (default). idun login runs a device-code flow and stores an Entra
bearer token. No admin role required — any tenant user with agent RBAC can
run it; admin rights are only needed to configure the agent, not to use it.
The token auto-rotates before expiry.
Hugging Face / GitHub. The wizard or idun login --backend <x> prompts for
a token and saves it (0600). Both offer a free tier; no Azure subscription or
card needed.
Ollama. Run a local Ollama server (e.g. ollama serve) and point Idun at it:
export OLLAMA_BASE=http://localhost:11434
export OLLAMA_MODEL=llama3.1
Switching backends
Globally via env, or per call via --backend:
export IDUN_BACKEND=hf # all future calls use HF
idun chat --backend github "Hi" # one-off override
Model overrides (optional): HF_MODEL, GITHUB_MODEL, OLLAMA_BASE,
OLLAMA_MODEL.
Quick test
idun chat "Hello" # azure (needs login first)
idun chat --backend hf "Hello" # any backend with creds set
Quickstart
idun chat "Summarize Contoso's sustainability comms in one sentence."
idun trace --backend azure "Use web_search to find the current CEO of Contoso."
from idun import IdunClient
# Azure (default)
res = IdunClient().complete("Your prompt here")
print(res.text) # final answer
for s in res.steps: # agent trajectory
print(s.kind, s.tool, s.query, s.status)
# Hugging Face (no Azure token needed)
res = IdunClient(backend="hf", hf_token="hf_xxx",
hf_model="microsoft/phi-3-mini-4k-instruct").complete("Hello")
print(res.text)
Commands
| Command | Purpose |
|---|---|
idun wizard |
universal first-run setup |
idun login [--backend X] |
store backend credentials |
idun status |
show active backend + credential state |
idun chat |
final answer only |
idun trace |
full trajectory (steps + text) |
idun export |
trajectory as JSON / Markdown |
idun packs / idun run |
curated prompt packs (e.g. Contoso) |
idun diff |
side-by-side trace diff of two prompts |
idun token |
inspect / refresh the Foundry token |
idun logo |
print the Foundry logo |
MCP server
idun_mcp.py is a zero-dependency stdio MCP server (no FastMCP / httpx):
python3 idun_mcp.py
Exposes idun_chat(prompt) and idun_trace(prompt). Add to any MCP client:
{ "mcpServers": { "idun": { "command": "python3", "args": ["/abs/path/idun-sdk/idun_mcp.py"] } } }
Docs mirror (GitMCP): https://gitmcp.io/qapdex-maker/idun-sdk/sse
Combine with Sentry (MCP)
Idun pairs well with Sentry's MCP server
so an agent can both call Idun and inspect Sentry errors. Add it remotely
(OAuth, note the /mcp suffix):
{ "mcpServers": { "sentry": { "url": "https://mcp.sentry.dev/mcp" } } }
Recommended combo: idun (calls the agent) + idun-docs (reads SDK docs) +
sentry (queries error tracking).
Azure request shape (verified)
POST {base}/api/projects/{project}/agents/{agent}/endpoint/protocols/openai/responses?api-version=2025-05-15-preview
Authorization: Bearer ***
{"model": "model-router", "input": "<prompt>", "max_output_tokens": 4096}
modelMUST be"model-router"(agent id is in the URL).- Do not send a
toolskey — the agent owns its tools (else400 invalid_payload).
Links
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file idun_sdk-0.1.33.tar.gz.
File metadata
- Download URL: idun_sdk-0.1.33.tar.gz
- Upload date:
- Size: 49.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8880cbc6bd8dd23e736995abbb742f8f1739481a4dd734ed88f71aa429528a4
|
|
| MD5 |
7bae8b7aeb9df0f59ffd48077b9e4917
|
|
| BLAKE2b-256 |
c6cbd69bb71dab594b947be2448f5803a2d5d0907064913a36771ef3eb4ce663
|
File details
Details for the file idun_sdk-0.1.33-py3-none-any.whl.
File metadata
- Download URL: idun_sdk-0.1.33-py3-none-any.whl
- Upload date:
- Size: 43.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0af8e07041bc55e7384bd2146bdf14c75dd7b7906ad102c09bec73b0b791def6
|
|
| MD5 |
2a7725deacfd967b0121fa0dbfccf0a6
|
|
| BLAKE2b-256 |
0fa910f9aee5ef4df4c53b16a9352bddb5f3a67d4a2274fb4a2e137acdab011b
|