Documentation index for AI agents: see /llms.txt. Markdown versions of every page are available at <path>.md or via Accept: text/markdown.
Reference

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]'

ParameterTypeDefault
schemaAnyrequired

Returns: dict[str, Any]

Normalize a Python schema input into JSON Schema.

Accepted inputs:

  • JSON Schema dictionaries.
  • Pydantic BaseModel classes.
  • Simple type maps such as {"query": str, "limit": int}.
  • Other Python type hints that Pydantic's TypeAdapter can 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'

ParameterTypeDefault
data_environmentDataEnvironmentConfig | Mapping[str, Any] | Nonerequired
target_database_urlstr | NoneNone
runtime_resource_idstrrequired

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.