Skip to main content

inis.run CodeAct provider for Microsoft Agent Framework

Project description

inis-agent-framework

Native inis.run CodeAct provider for Microsoft Agent Framework (agent_framework.ContextProvider). Gives an Agent a real, isolated execute_code tool backed by inis.run's persistent Python interpreter.

PyPI License: MIT Python

CodeAct providers are a young, beta convention upstream. agent-framework-core itself is stable; Microsoft's own first-party CodeAct backends (agent-framework-monty, agent-framework-hyperlight) are each beta. Verified against agent-framework-core==1.13.0.

Install

pip install inis-agent-framework

Quickstart: attached (recommended)

One inis.run session for the whole conversation, owned by your app:

from inis import AsyncClient
from agent_framework import Agent
from inis_agent_framework import InisCodeActProvider

client = AsyncClient()
session = await client.sessions.create(egress_default="deny")
codeact = InisCodeActProvider.wrap(session)

agent = Agent(client=chat_client, name="assistant", context_providers=[codeact])
await agent.run("Use execute_code to compute 6 * 7.")
await session.destroy()  # this app owns the session; the provider never will

Reconnect a later process to the same persistent interpreter context by session ID alone — no snapshot, no workspace round-trip:

codeact = InisCodeActProvider.attach("ses_abc123")
agent = Agent(client=chat_client, context_providers=[codeact])
await agent.run("What was x again?")  # sees state from the earlier process

Owned: the provider creates and destroys the session for you

from inis_agent_framework import InisCodeActProvider

codeact = await InisCodeActProvider.create(egress_default="deny")
try:
    agent = Agent(client=chat_client, context_providers=[codeact])
    await agent.run("...")
finally:
    await codeact.aclose()  # destroys the session

Either way, only execute_code is model-visible.

Persistent interpreter state, not a fresh one per call

InisExecuteCodeTool runs through AsyncSession.run_code(), backed by a real persistent Python process inside the session: a variable set in one execute_code call is still there in the next one, across separate tool calls and separate agent.run() invocations against the same session, until restart_context() is called or the session is torn down.

What it does

  • execute_code (persistent Python interpreter) — text/image/table/json/error results mapped to agent_framework.Content
  • Interpreter state across calls and agent.run() invocations — .attach() resumes the same context
  • restart_context() — discards the interpreter context without touching the session's filesystem or lifecycle
  • Owned/attached lifecycle split — .create() owns and destroys; .wrap()/.attach() never do

Notes

call_tool bridging to host-registered tools is not implemented, deliberately: inis.run's execute_code runs in a real remote VM with no channel for the guest to call an arbitrary host function mid-cell — that would let sandboxed code call any tool the agent has, unbounded. workspace_root/file_mounts (host-directory binding) is not implemented either: an inis.run session runs on separate hardware — there's no host directory to bind. Use session.read_file()/write_file() directly instead. .NET is out of scope: this package is Python-only, matching agent-framework-core's Python package. True remote cancellation of an in-flight execute_code call is not implemented — run_code() is timeout-only; a timeout_ms still ends the call and the interpreter context stays usable afterward.

Development

pip install -e ".[dev]"
pip install -e ../python           # inis core SDK, editable
pytest

Links

Built and run in the EU. Your code and data never leave Europe.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inis_agent_framework-0.1.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

inis_agent_framework-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file inis_agent_framework-0.1.0.tar.gz.

File metadata

  • Download URL: inis_agent_framework-0.1.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for inis_agent_framework-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9ea5c3d217061764c8e50a4fdb93f651003ad931cbad99002692a074d16733d6
MD5 c737d9b73fc269b9150591ff27c40739
BLAKE2b-256 c9315a9fe5bfe6d573d1d0965713de5211dd1e3e9900edaf54ff1965fd5ad767

See more details on using hashes here.

Provenance

The following attestation bundles were made for inis_agent_framework-0.1.0.tar.gz:

Publisher: sdk-agent-framework-publish.yml on 4ver/inis.run

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inis_agent_framework-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for inis_agent_framework-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 906663e4fe58c42e2693450fbda257af9b6c0cdc87fc07c3b242e6e2d0347fae
MD5 4f1ff1cf25da3bfbcb41138001d65469
BLAKE2b-256 e2ee955eb93cdfb307bf144fc4d0fc153259b632b00352cff5e0b530b0fd5683

See more details on using hashes here.

Provenance

The following attestation bundles were made for inis_agent_framework-0.1.0-py3-none-any.whl:

Publisher: sdk-agent-framework-publish.yml on 4ver/inis.run

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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