Python SDK

Resource reference

Python method names and call shapes for resources on IaGenify(api_key=...). Optional arguments are keyword arguments; results are returned synchronously.

snake_case callbackskeyword argumentsno await

Client methods

api.get_user()
api.catalogue()
api.get_storage()
api.session()

Models

assistant = api.models.create(model="gemini-3.5-flash", settings={"instructions": "Be concise."})
assistant.generate(inputs=[{"type": "text", "content": "Hello"}])
assistant.get_history()
api.models.turn(model="gemini-3.5-flash", messages=[{"role": "user", "content": "Hello"}])
api.models.list(limit=30)
api.models.get(assistant.id)

Images and structured input

# Keep each input part explicit. Image URLs and workspace paths use the same
# server-side input contract as the JavaScript SDK.
result = assistant.generate(inputs=[
    {"type": "text", "content": "Compare these two versions."},
    {"type": "image", "url": "https://example.com/before.png"},
    {"type": "image", "path": "./after.png"},
])

# A vision input already held by the application can be sent as base64.
result = assistant.generate(inputs=[
    {"type": "text", "content": "Describe this image."},
    {"type": "image", "content": png_base64, "mime": "image/png"},
])

# Models that accept passage ranking use a passages part.
ranked = assistant.generate(inputs=[
    {"type": "text", "content": "Which passage answers the question?"},
    {"type": "passages", "content": [chunk_a, chunk_b, chunk_c]},
])

File objects

from pathlib import Path

document = api.files.create(
    name="brief.md",
    content=Path("brief.md").read_bytes(),
    mime_type="text/markdown",
)
saved = document.save(storage_id=storage_id)
print(document.source_id, document.location, saved.get("ok"))

loaded = api.files.get(document.source_id)
print(loaded.name, loaded.content)
loaded.content = b"Updated brief\n"
loaded.update()
api.files.delete(document.source_id)

Search, fetch and conversion

results = api.search.search(query="Python packaging standards")
page = api.fetch.fetch(url="https://example.com/guide")

with open("report.docx", "rb") as source:
    markdown = api.convert.convert(
        from_format="docx",
        to="markdown",
        file=source,
    )

Connected storage

storage = api.storage.get()  # the default connected storage
if storage is not None:
    summary = storage.run(action="overview")
    print(summary)

storages = api.storage.list()
usage = api.cloud.usage()

Agents

agent = api.agents.create(runtime="local", model="gemini-3.5-flash", machine=api.storage.get(), mode="ask", on_permission=lambda request: "once")
result = agent.run(message="Read the project README and summarize it.")

Server agent

model = api.models.create(model="gemini-3.5-flash", memory=False)
agent = api.agents.create(
    model=model,
    tools={"search": api.tools.search},
    max_steps=8,
    budget=30,
)
result = agent.run(
    inputs=[{"type": "text", "content": "Find recent Python packaging guidance."}],
    on_step=lambda step: print(step),
)

Resource method inventory

Python resourceMethods and child resources
auth / keysauth.logout(), auth.revoke_session(id), auth.update_profile(...); keys.list(), keys.revoke(id)
models / memorymodels.create/get/list/turn(); session generate/get_history/destroy(); memory.list/save/delete()
files / storagefiles.create/get/list/delete(); file save/update(); storage connect/create/device/get/list/local/remove(); connected storage run()
cloud / toolscloud.usage(), cloud.addons.buy(); search.search(), fetch.fetch(), convert.convert(); tools.search/fetch/screenshot/convert/list_documents/read_document/write_document/create_folder/move_document/delete_document/query_storage
agentsagents.create/get/list(); server agent run/stop/destroy(); local agent run/get_history/compact/checkpoints/rewind/stop/destroy(); agents.skills and agents.subagents libraries.
workflowsworkflows.create/get/get_run/list(); workflow run/runs/run_step/update/destroy(); run refresh/wait/resume/retry/cancel()
domainsdomains.add/expiring/get/list/remove/search/servers/tlds(); domain attach/attachments/check/detach/migration/owner/serve/tls/unserve/verify/remove(); child records, dnssec, redirects, mail
mailmail.create/get/list/remove/usage(); mailbox send/update/forward/remove(); child aliases, messages, contacts
hosts / computehosts.create/get/kinds/list/remove/usage(); host deploy/deploys/update/rollback/usage/remove(); compute.status/exec() and compute.terminals
MCPmcp.connect/list/get/update/call/disconnect/for_agent/tools(); standalone McpClient.initialize/list_tools/call/close()

Python helper exports

from iagenify import (
    AGENT_MODES, MEDIA_OPTIONS, PROMPT_OPTIONS,
    parse_prompt, parse_token_count, storage_slug,
    sanitize_schema, tool_name_for, create_mcp_tools,
    LocalFiles, LocalTerminals, LocalLibrary, AccountLibrary,
)

tokens = parse_token_count("1.5M")
options = MEDIA_OPTIONS["image"]

Agent tool behavior

Tool declarations and local execution are different surfaces

Python's api.tools.image/video/voice/music entries are agent-only declarations, matching the JS SDK contract; they do not call standalone image or media routes. The Python local agent executes workspace and shell tools, web search and fetch, storage and document actions, memory, workflow, MCP, skills, bounded subagents, custom Python tools, and media generation. Autonomous mail, DNS, and deployment actions are not included in Python 0.1.0.

Ceci est une référence 0.2, pas une promesse de parité complète

The Python resource reference lists the callable Python surface. See the relevant Python example beside each JavaScript example for its Python equivalent or a clearly marked runtime limitation.

Marques

brand = api.brand.create(name="Qahwa Lab", logos=[{"path": "logo.svg", "main": True}])
brand.update(identity={"tagline": "Roasted every morning"})
brand.palette.set([{"hex": "#6B3E26", "role": "primary"}])
brand.assets.add({"cloud": "Brand/storefront.jpg", "role": "hero"})
brand.logos.main, brand.palette.role("primary"), brand.completeness
api.brand.list(); api.brand.get(brand.id); api.brand.remove(brand.id)

Écrire pendant que l’agent travaille

agent.run() bloque, donc agent.queue() s’appelle depuis un autre fil. Il est sûr entre fils, et répond comme l’appel JavaScript.

import threading

worker = threading.Thread(target=lambda: agent.run(message="Clean up the Notes folder"))
worker.start()
agent.queue("Also keep a copy of plan.md")   # {"queued": True, "id": "u1", "position": 1}
worker.join()