Skip to main content

Python runtime for the Forma language

Project description

forma-lang

Python runtime package for Forma task files.

The package exposes FormaRuntime for executing Forma source, ModelProvider for custom adapters, HttpJsonProvider for HTTP JSON model endpoints, OpenAIResponsesProvider for OpenAI Responses API execution, and StaticProvider and RecordingProvider for deterministic tests of agent blocks. The current runtime supports the MVP task shape used by the shared conformance fixtures:

  • deterministic compute blocks that produce a message from user_name
  • verify checks for message.length > 0 and message.words <= 12
  • agent blocks executed through an explicit fake provider such as StaticProvider
from forma import FormaRuntime, StaticProvider

runtime = FormaRuntime(
    model_provider=StaticProvider({"message": "Hello, Sam. Good to see you."})
)

result = runtime.run_source(source, input={"user_name": "Sam"}, source_name="task.forma")

Use RecordingProvider when tests need to assert which instruction, input, permissions, and output contract the runtime sent to the provider.

run_source returns a FormaResult with ok, output, trace, diagnostics, verification, and error fields.

For real agent execution, keep the provider key and model name in the host program or environment, then pass a provider object to FormaRuntime. The runtime calls run_agent(instruction, values, permissions, tools, output, schemas) when it reaches the task's agent block; providers that only accept the original four arguments still work. Providers call tools.require("read") or another declared permission before host workspace actions. Use run_task(source, "task_name", input, source_name) when source text contains multiple tasks, or run_file(path, "task_name", input) when the contract lives on disk.

Local Checks

Run the Python package tests from the repository root:

python -m pytest packages/forma-python/tests -q

For workspace-level validation, also run:

corepack pnpm check

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

forma_lang-0.1.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

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

forma_lang-0.1.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: forma_lang-0.1.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for forma_lang-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0201bdc58ee4d331dc67e205cae0aa5426015bbd7cc50f9a710132bc7ab52038
MD5 3aec2d313c24cfe197e2b2005a516b2f
BLAKE2b-256 f9c0aef9405ab22f9787948bcff6a688185608a9f7a43191d39b0010e1f79f58

See more details on using hashes here.

Provenance

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

Publisher: publish-python.yml on syndicalt/forma

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

File details

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

File metadata

  • Download URL: forma_lang-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for forma_lang-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b6118f5f92df560f7a5521f68ca79b4689744c7936e4def1232ca5f95cd53746
MD5 eabcada8ab16b9f1a2c1f30e6611a6a4
BLAKE2b-256 d887934a9f5a763a4f357d130f9f742aa9f13b9e93c0ca5c8e7604d9b181f6b9

See more details on using hashes here.

Provenance

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

Publisher: publish-python.yml on syndicalt/forma

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