This release is a pre-release and may not be stable for production use.
datasette-agent-micropython
Run Python code in a MicroPython/WASM sandbox
Installation
Install this plugin in the same environment as Datasette.
datasette install datasette-agent-micropython
Usage
This plugin adds an execute_micropython tool to
Datasette Agent. The tool runs
Python code using a sandboxed MicroPython interpreter compiled to WASM.
Use it for pure computation, parsing, data transformation, math, and checking
algorithms. Output is captured from stdout and stderr, so code should use
print() to return values:
print(sum(range(10)))
Each Datasette Agent conversation gets its own persistent MicroPython interpreter. Variables, imports, and functions defined in one tool call can be reused later in the same conversation:
def fib(n):
a, b = 0, 1
out = []
for _ in range(n):
out.append(a)
a, b = b, a + b
return out
print(fib(10))
That state is not shared with other conversations. Use reset_context=true to
clear the current conversation's interpreter before running code. If execution
times out, exhausts fuel, or traps the WASM runtime, that conversation's
interpreter is discarded and the next call starts fresh.
No network APIs are available, and no host filesystem is exposed by default.
The MicroPython environment includes a read_only_sql_query() helper for
querying Datasette databases:
result = read_only_sql_query(
"data",
"select name, qty from items where qty > :min_qty",
{"min_qty": 2},
)
print(result["columns"])
print(result["rows"])
It accepts name_of_database, sql, and an optional params dict. It uses the
current actor's execute-sql permission and returns a dict containing
columns, rows, and truncated, or an error key.
The tool accepts:
python- MicroPython code to executereset_context- clear this conversation's interpreter before runningshow_result- render the code and captured output inline for the user
Use show_result=true when the user asked to see the code or output, or when
showing both would help with explanation, debugging, teaching, or
reproducibility. The rendered HTML shows the executed code, then the captured
stdout. When this is set, the tool result tells the agent that the output has
already been shown to the user and does not need to be repeated. Leave it unset
for scratch calculations.
Configuration
Configure the plugin using Datasette plugin settings:
plugins:
datasette-agent-micropython:
max_sessions: 16
wall_clock_timeout_seconds: 5.0
memory_bytes: 16777216
fuel: 10000000
max_output_chars: 10000
Settings:
max_sessions- maximum live conversation interpreters to keep; defaults to16. The least recently used interpreter is closed when the limit is exceeded.wall_clock_timeout_seconds- timeout for each code execution; defaults to5.0.memory_bytes- maximum WebAssembly linear memory for each interpreter; defaults to16777216(16MB).fuel- Wasmtime fuel budget refreshed for each execution; defaults to10000000.max_output_chars- maximum captured output/error characters returned to the model; defaults to10000.
Development
To set up this plugin locally, first checkout the code. You can confirm it is available like this:
cd datasette-agent-micropython
# Confirm the plugin is visible
uv run datasette plugins
To run the tests:
uv run pytest
Metadata
Release files for datasette-agent-micropython 0.1a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datasette_agent_micropython-0.1a0.tar.gz | 14.3 kB | With provenance | Details for datasette_agent_micropython-0.1a0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datasette_agent_micropython-0.1a0-py3-none-any.whl | Python 3 | none | any | Details for datasette_agent_micropython-0.1a0-py3-none-any.whl |
Total release size: 26.6 kB
Release files / datasette_agent_micropython-0.1a0.tar.gz
| Download URL | datasette_agent_micropython-0.1a0.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aff205fb4aeb31efe6263276eda1b09f10835ba14fcc8b34c708eb0ff457c20f
|
|
BLAKE2b-256 checksum How to use checksums |
ca9aabaf729d2aa076702be2f87364a243ca7bc86b1b9f94d3507c3005d5e158
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.
Transparency logRelease files / datasette_agent_micropython-0.1a0-py3-none-any.whl
| Download URL | datasette_agent_micropython-0.1a0-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b8207e48beccebb9cf62caed7d92666de3a08abbcb7e5d23039cbbec7ddbe98
|
|
BLAKE2b-256 checksum How to use checksums |
e2c78a64d677058d7665ecf04b9107f0d6a1edc17c2959691ef869e691b2f0a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.
Transparency logSecurity for datasette-agent-micropython 0.1a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for datasette_agent_micropython-0.1a0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.