Schema and utilities
Small public helpers used by multiple authoring APIs.
Small public helpers used by multiple authoring APIs.
normalize_schema(...) is the shared schema normalizer behind tools, plans,
and references. Use it when you need to inspect the JSON Schema that Flow AI
will send to the Rust runtime before creating a ToolSpec, PlanSpec, or
ReferenceSpec.
normalize_data_environment(...) validates the same data-environment mapping
accepted by create_runtime(...) and Studio workspace bindings, without
constructing a runtime. It returns the camelCase wire mapping consumed by the
Rust runtime, or None when the environment is empty.
normalize_schema
normalize_schema(schema: 'Any') -> 'dict[str, Any]'
| Parameter | Type | Default |
|---|---|---|
schema | Any | required |
Returns: dict[str, Any]
Normalize a Python schema input into JSON Schema.
Accepted inputs:
- JSON Schema dictionaries.
- Pydantic
BaseModelclasses. - Simple type maps such as
{"query": str, "limit": int}. - Other Python type hints that Pydantic's
TypeAdaptercan export.
normalize_data_environment
normalize_data_environment(data_environment: 'DataEnvironmentConfig | Mapping[str, Any] | None', target_database_url: 'str | None' = None, *, runtime_resource_id: 'str') -> 'dict[str, Any] | None'
| Parameter | Type | Default |
|---|---|---|
data_environment | DataEnvironmentConfig | Mapping[str, Any] | None | required |
target_database_url | str | None | None |
runtime_resource_id | str | required |
Returns: dict[str, Any] | None
Validate and normalize a data environment without constructing a runtime.
Args:
data_environment: DataEnvironmentConfig or mapping; snake_case
and camelCase keys are both accepted. See
DataEnvironmentConfig.
target_database_url: Shorthand for
data_environment["target_database_url"].
runtime_resource_id: The runtime tenant the environment must agree
with; a data environment that pins a different tenant_id is
rejected.
Returns:
CamelCase mapping passed to the Rust runtime, or None when no
environment data is supplied. When present, the mapping can contain
tenantId, workspaceId, kv, targetDatabase,
targetDatabaseUrl, targetDatabaseSchema, catalog, and
catalogSearch. See the
DataEnvironmentConfig
table for key meanings.
Raises:
ValueError: If target_database_url conflicts with the data
environment, tenant_id does not match
runtime_resource_id, or a storage descriptor has an
unsupported kind.
TypeError: If a value has an invalid type.
Action dispatcher
The action dispatcher is the host-side write boundary for approved plan actions. It is where Flow AI hands normalized, validated actions back to your application so your code can...
Changelog
1.0.0a1 is the Python package version for the v1.0.0-alpha.1 private preview tag. The public API is stable enough to build against, but breaking changes are still possible during...
