Skip to main content

Idun SDK

Azure AI Foundry PyPI version Python License stdlib-only

Azure AI Foundry logo

Thin, stdlib-only client + CLI for the NatureLM-Idun-5-MoE agent on Azure AI Foundry — with a pluggable multi-backend layer.

No httpx, no azure-identity, no Flask — it runs headless on Termux/Android with nothing but the Python standard library. Idun is a tool agent (it reasons and calls tools like web_search); this SDK surfaces the full agent trajectory (reasoning steps + tool calls) instead of a black-box answer.

Multi-backend (v0.1.31+): the same IdunClient API dispatches to azure (default), hf (Hugging Face), github (GitHub Models), or ollama (local). Non-Azure backends need no Foundry token, so Idun keeps working even when the Azure subscription is suspended.


Install

pip install idun-sdk

Installs the idun CLI, the idun Python package, and the stdlib MCP server idun_mcp.py.

Authenticate

idun login          # device-code flow, token saved to ~/foundry_token.txt

No admin role requiredidun login returns a plain Entra bearer token for the Foundry endpoint. Any tenant user with agent access (RBAC) can run it; admin rights are only needed to configure the agent, not to use it. The token auto-rotates before expiry.

Quickstart

# final answer only
idun chat "Summarize Contoso's sustainability communications in one sentence."

# full agent trajectory (reasoning + tool steps)
idun trace "Use web_search to find the current CEO of Contoso."
from idun import IdunClient

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)

Features

Command Purpose
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

Multi-backend (no Foundry dependency)

Idun runs on four interchangeable backends behind the same IdunClient API. Non-Azure backends need no FOUNDRY_TOKEN, so the SDK keeps working even when the Azure subscription is suspended.

idun wizard                 # universal first-run setup -> writes ~/.idunrc
idun status                 # show active backend + credential state
idun login --backend hf     # store a Hugging Face token
idun chat --backend github "Hello"   # one-shot backend override
Backend Credentials Cost Notes
azure Entra device-code (idun login) paid default; full tool-agent trajectory
hf HF_TOKEN / ~/hf_token.txt free tier serverless Inference API; flat answer
github GITHUB_TOKEN / ~/github_token.txt free tier 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). Per-backend model overrides: HF_MODEL, GITHUB_MODEL, OLLAMA_BASE, OLLAMA_MODEL.

from idun import IdunClient

# Hugging Face (no Azure token needed)
res = IdunClient(backend="hf", hf_token="hf_xxx", hf_model="microsoft/phi-3-mini-4k-instruct")
print(res.complete("Hello").text)

# GitHub Models (free)
res = IdunClient(backend="github", github_token="ghp_xxx").complete("Hi")

Note: non-Azure backends return a flat answer (res.steps == []) — the tool-agent trajectory (reasoning + web_search) is an Azure-Idun feature.

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/traces. Sentry MCP is a separate, optional provider — the Idun SDK stays stdlib-only.

Remote (zero-setup, OAuth — note the /mcp suffix):

{ "mcpServers": { "sentry": { "url": "https://mcp.sentry.dev/mcp" } } }

Stdio (OAuth via mcp-remote, no static token needed):

{ "mcpServers": { "sentry": { "command": "npx", "args": ["-y", "mcp-remote@latest", "https://mcp.sentry.dev/mcp"] } } }

Authenticate once (opens a browser for the OAuth flow):

/mcp auth sentry

Recommended combo for a foreign agent: idun (calls the agent) + idun-docs (reads the SDK docs) + sentry (queries error tracking). The agent can invoke Idun and, when a call fails, pull the correlated Sentry issue on its own.

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}
  • model MUST be "model-router" (agent id is in the URL).
  • Do not send a tools key — the agent owns its tools (else 400 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

idun_sdk-0.1.32.tar.gz (48.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

idun_sdk-0.1.32-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

Details for the file idun_sdk-0.1.32.tar.gz.

File metadata

  • Download URL: idun_sdk-0.1.32.tar.gz
  • Upload date:
  • Size: 48.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for idun_sdk-0.1.32.tar.gz
Algorithm Hash digest
SHA256 fa6c076562d778d09b4400942105ce63feee8cab09a81eb8cdbb6fd397d16f75
MD5 8d6b7810e21ba9ffbc6b3ffe64675a8e
BLAKE2b-256 08d047a3a41d4b6925c38fc3a14cd30bf5452264557770350f12f902c7fc3718

See more details on using hashes here.

File details

Details for the file idun_sdk-0.1.32-py3-none-any.whl.

File metadata

  • Download URL: idun_sdk-0.1.32-py3-none-any.whl
  • Upload date:
  • Size: 42.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for idun_sdk-0.1.32-py3-none-any.whl
Algorithm Hash digest
SHA256 f767cb2335b840f7890f6cd2bec5abeb64fa7cbf0718b6b98a459dc2e03ebaf0
MD5 fde9bc6e53f7c9968c8e5ea1bb1bc472
BLAKE2b-256 3a20dd3369d67fb41bcb96c2aa3447f9e4e6b0cf80e5c73ea5a1106574375e5e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page