Skip to content

YAML configuration API ​

Field lists for YAML configuration. The import path is elsai.config. For when to use each block, see YAML configuration.

Installation ​

bash
pip install --upgrade --extra-index-url https://elsai-agents.elsai.ai/root/ "elsai-yaml==0.4.3"

Loaders ​

FunctionSignatureReturns
yaml_to_agent(path, entry, *, memory_run_id=None, on_agent_built=None)An Agent
yaml_to_knowledge(path, entry)A knowledge base
yaml_to_graph(path, entry, *, on_agent_built=None)A graph
yaml_to_workflow(path, entry, *, on_agent_built=None)A WorkflowPipeline
yaml_to_mcp(path, entry)An unstarted MCPClient
yaml_to_http(path, entry)One HTTP agent tool

path is a YAML file of named blocks. entry is the block name. A missing file raises FileNotFoundError. A missing block, a wrong type, or an unknown key raises ValueError.

memory_run_id overrides MemoryConfig.run_id. It requires a memory field on the agent.

on_agent_built is an optional (entry, agent) hook on yaml_to_agent, yaml_to_graph, and yaml_to_workflow. It runs after each Agent block in that build is constructed, including a specialist, and before that agent is wrapped as a tool. A cached block is not reported again.

${name} inserts a whole named block. ${name.field} is rejected. {{$ENV_VAR:default}} reads an environment variable while the file loads. Secret fields and live clients (boto_session, client, API key fields) are rejected.


Agent block ​

type: Agent is required.

KeyForm
name, descriptionString
system_promptString
model${block}, an inline {type: <Model>, ...} map, or a Bedrock model id string
toolsList of elsai_tools.* modules, ./file.py paths, or AgentAsTool maps
httpList of HTTPTool maps or ${block} refs. See HTTP
structured_outputmodule:Class pointing at a Pydantic BaseModel
structured_output_promptString
guardrailsMap or ${block}
memoryMap or ${block}
knowledgeMap. See Knowledge
mcpList of MCPClient maps or ${block} refs
pluginsList of plugin maps or ${block} refs. See Plugins
sandbox_modesandbox or local_dev
execution_backendBackend map or ${block}
workspace_rootHost directory for the direct sandbox path
workspace_sync_policyexclude_patterns and sync_include_patterns
sandbox_manager{ttl_seconds}
sandboxtype: Sandbox map or ${block}
sandbox_attach_moderead_write or read_only
sandbox_output_offloadOffload policy. See Sandbox

Model type values: BedrockModel, AnthropicModel, AnthropicBedrockModel, OpenAIModel, OpenAIResponsesModel, AzureOpenAIModel, GeminiModel, LiteLLMModel, MistralModel, OllamaModel, LlamaCppModel, LlamaAPIModel, SageMakerAIModel, WriterModel.

AgentAsTool ​

KeyMeaning
typeAgentAsTool
agent${block} of an Agent
modequeue, reject, or spawn
preserve_contextWhether the specialist sees the supervisor's context
name, descriptionTool name and description shown to the supervisor

HTTP ​

type: HTTPTool. Attach with http: on an Agent block. yaml_to_http(path, entry) builds one tool and no agent. Needs elsai-agents 0.4.1 or later. agent.cleanup() closes clients the loader created.

KeyRequiredMeaning
nameyesLetters, digits, _, -, at most 64 characters
descriptionyesNon-empty string
endpointyesAbsolute http or https URL
methodyesGET, POST, PUT, PATCH, or DELETE
parametersMap of name to a JSON Schema object
requiredList of parameter names declared in parameters
defaultsMap of parameter name to a value
headersString map
sendbody or query. Omit it and POST, PUT, and PATCH use a JSON body. GET and DELETE use query parameters
timeout_secondsNumber greater than 0. Default 30
credentialString. Use {{$ENV_VAR:}}
credential_inheader, query, or body
credential_nameNon-empty string
credential_templateString. {} is the credential value. Used for a header
output_schemaJSON Schema object. The response is not validated against it

client is rejected. The same ${block} may be listed once per agent.


Memory ​

A named leaf requires type: MemoryConfig. An inline map may omit type.

KeyRequiredMeaning
run_idyesConversation id. Session key is {run_id}:{role}
pipelineyesNon-empty list of steps
roleDefaults to default
persistenceelsai_file or elsai_json
file_store_dirFolder for elsai_file
elsai_store_dirFolder for elsai_json
summarizer_llmModel leaf for ElsaiSummarizationStep
similarityTurn recall. See below
semanticFact recall
semantic_llmModel used while extracting facts
semantic_strategyHow facts are stored

metadata_filter and multiagent_mode on the memory map are rejected. window_size on the map is rejected.

StepStoreFields
ElsaiSlidingStepelsai_filewindow_size, should_truncate_results
ElsaiSummarizingStepelsai_filepreserve_recent_messages, summary_ratio
ElsaiTrimmingStepelsai_jsonmax_messages, max_tokens, preserve_recent, preserve_system
ElsaiSummarizationStepelsai_jsontrigger_count, preserve_system. Requires summarizer_llm
ElsaiLRUStepelsai_jsonmax_messages, preserve_system, preserve_recent
ElsaiTTLStepelsai_jsonttl_seconds, preserve_system, preserve_recent, use_last_accessed
ElsaiSimilarityStepelsai_jsonNo step fields. Requires sibling similarity

At most one shaping step (ElsaiTrimmingStep, ElsaiSummarizationStep, ElsaiLRUStep, ElsaiTTLStep). Native steps and shaping steps cannot share a pipeline. ElsaiSimilarityStep cannot sit beside either. Use similarity: next to a shaping step instead.

similarity ​

KeyMeaning
embedding${block} or inline EmbeddingBackend. Required
vector${block} or inline VectorBackend. Required
top_kMatches to inject
injection_modesystem_append or user_preamble
metadata_filterFilter on stored message metadata

semantic and semantic_strategy ​

semantic keys: user_id_key, injection_mode, query_from_last_user_message.

semantic_strategy keys: embedding, vector, llm, trigger_count, collection_name, namespace, top_k, similarity_threshold.

EmbeddingBackend and VectorBackend ​

ProviderKeys
bedrockmodel_name, aws_region. Optional: aws_access_key_id, aws_secret_access_key, aws_session_token
azuremodel, azure_endpoint, azure_api_version, azure_deployment. Optional: azure_api_key
chromacollection_name, persist_directory
pineconeindex_name, namespace, dimension. Optional: pinecone_api_key
weaviatecollection_name, connection_type, host, port or cluster_url, schema, use_default_vectorizer, distance. Optional: auth_credentials

A present credential must be a non-empty string. Omit it and the client still reads the environment variable.


Knowledge ​

type: KnowledgeBaseConfig. Required: chunking, embedding, vector, retrieval.

KeyMeaning
name, descriptionLabels
chunkingstrategy (characters or tokens, default characters), chunk_size, chunk_overlap
embedding, vectorBackend leaves
retrievalstrategy (hybrid or dense, default hybrid), top_k (at least 1, default 5), metadata_filter
modelModel leaf. Required for a written answer and for agentic attach
system_promptInstruction for the written answer
structured_outputmodule:Class. Requires model
structured_output_promptExtra instruction for that schema
parsertype: DocumentParse. Required for PDF
elsai_kb_store_dirSidecar directory. Required for Pinecone and Weaviate

parser keys: num_workers, verbose, auto_routing, provider, model, include_detailed_structure, optional api_key. A present api_key must be a non-empty string. Omit it and Docloom reads DOCUMENT_EXTRACTOR_API_KEY.

Agent knowledge: keys:

KeyMeaning
base${block} of a KnowledgeBaseConfig. Required
modebasic or agentic
injection_modesystem_append or user_preamble
agentic.max_roundsRequired when mode is agentic, and at least 1

Guardrails ​

type: GuardrailSystem on a named leaf.

KeyMeaning
input_checks, output_checksCheck the user prompt, and assistant prose
check_toxicity, check_sensitive_data, check_semanticWhich classifiers run
check_off_topic, check_sql_syntaxTopic and SQL checks
toxicity_thresholdToxicity cutoff
block_toxic, block_sensitive_data, block_off_topicBlock when that check fails
allowed_topicsTopics kept when off-topic checking is on
sql_dialectDialect for the SQL check
tool_authorizationRole rules. See below

tool_authorization ​

KeyMeaning
enabledTurn authorization on
denied_toolsBlocked for every role. Tool names, not import paths
sensitive_toolsNeed invocation_state["guardrail_metadata"]
roles.<name>.allowed_toolsTools that role may call
default_roleUsed when the call has no user_role

Graph ​

type: Graph. nodes is a non-empty map of node id to an Agent ${block}. edges is a list of {from, to}.

KeyMeaning
name, graph_idLabels
entry_pointsNode ids where a run can start
max_node_executionsCap on node runs
execution_timeout, node_timeoutTime limits
reset_on_revisitWhether a revisited node resets

condition on an edge is rejected. session_manager, hooks, hook_providers, and plugins are rejected.

Call the graph with graph(prompt).


Workflow ​

type: Workflow. steps is a non-empty list. An item is an Agent ${block}, or parallel: with a list of Agent refs.

KeyMeaning
nameLabel
prompt_templatePrompt for each sequential step. Placeholders: input, previous_output, step_index
merge_templateText after a parallel group. Placeholders: input, step_0…, parallel_0…

pipeline(task) returns the final text. pipeline.run_traced(task) returns (final_text, traces).


MCP ​

type: MCPClient. transport defaults to stdio.

KeyTransportsMeaning
commandstdioRequired. Executable
args, env, cwdstdioProcess arguments, environment, working directory
server_urlsse, streamable_httpRequired. http or https
headerssse, streamable_httpString map
timeout, sse_read_timeoutsse, streamable_httpPositive numbers
terminate_on_closestreamable_httpBoolean
startup_timeoutallPositive number
prefixallPrepended to tool names. Letters, digits, _, -, at most 62 characters
tool_filtersallallowed and rejected lists of tool names
use_cache, cache_dirallTool-list cache
tasks_configallttl and poll_timeout as durations

elicitation_callback, auth, transport_callable, and client are rejected.


Plugins ​

plugins: is a list of inline maps or ${block} refs. One of each type per agent. A Graph or Workflow block rejects plugins:.

AgentSkills ​

KeyRequiredMeaning
skillsyesA path, an https:// URL, or a list of those
strictBoolean. Default false. true raises on a bad source and needs elsai-agents 0.4.2
state_keyNon-empty string. Default agent_skills
max_resource_filesPositive integer. Default 20

AgentsMdPlugin ​

KeyMeaning
pathOne AGENTS.md file. Hierarchy keys are ignored
start_pathWhere the upward walk starts. When path and start_path are both omitted, discovery starts at the YAML file directory
rootUpper boundary. An ancestor of start_path
merge_hierarchyBoolean. Default true
max_filesPositive integer or null. Default 3
on_exceedwarn (default) or error
state_keyNon-empty string. Default agents_md

LLMSteeringHandler ​

KeyRequiredMeaning
system_promptyesNon-empty string
modelModel block, same forms as an Agent model
context_providersList of {type: LedgerProvider}. Omit for the ledger. [] turns it off

A second LedgerProvider is rejected. Resume an interrupt on the same agent with interruptResponse.

SandboxPlugin ​

KeyMeaning
typeSandboxPlugin. No other keys

type: GuardrailsPlugin is rejected. Set guardrails: on the Agent block.


Sandbox ​

A direct sandbox (sandbox_mode plus execution_backend) and a shared sandbox (sandbox) cannot be combined. Either one requires type: SandboxPlugin. sandbox_mode: off is rejected. local_dev requires LocalSandboxBackend.

A shared Sandbox is not started while the file loads. The first run starts it. That needs elsai-agents 0.4.2. Inside one yaml_to_graph or yaml_to_workflow build, agents that reference the same named block share one sandbox.

Sandbox ​

KeyRequiredMeaning
workspace_idyesNon-empty string
backendyesA backend map or ${block}
ttl_secondsyesPositive number
seed_from, sync_destFilesystem paths
seed_excludeList of strings
sync_policyexclude_patterns and sync_include_patterns

Backends ​

typeRequiredOther keys
LocalSandboxBackendworkspace_roottimeout, max_output_bytes (positive integers), inherit_env (boolean), env (string map)
AgentCoreSandboxTemplateregion, identifier, session_timeout_seconds. Extra agent-core-code-interpreter
DaytonaSandboxTemplateapi_key, api_url, target, default_timeout, sync_polling_interval. Extra sandbox-daytona

Leave api_key unset and set DAYTONA_API_KEY in the environment.

sandbox_output_offload ​

Requires a direct or shared sandbox. preview_tokens must be lower than max_result_tokens.

KeyDefaultMeaning
storagerequiredInMemoryStorage, FileStorage (artifact_dir, default artifacts), or S3Storage (bucket, optional prefix, region_name)
max_result_tokens2500Positive integer
preview_tokens1000Non-negative integer
include_retrieval_toolBoolean
tool_namesNon-empty list drawn from execute, read_file, write_file, list_dir

Copyright © 2026 elsai foundry.