System propt and action schema

This commit is contained in:
2024-11-02 21:25:36 +01:00
parent 2a15708145
commit 4a40eabe30
4 changed files with 187 additions and 249 deletions

View File

@@ -1,148 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Root element containing a sequence of actions to be executed -->
<xs:element name="actions">
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<!-- Delete command removes an entry from working memory by its ID -->
<xs:element name="delete">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="start_container"/>
<xs:element ref="write_container_stdin"/>
<xs:element ref="read_container_stdout"/>
<xs:element ref="read_container_stderr"/>
<xs:element ref="wait_container"/>
<xs:element ref="set_model_path"/>
</xs:choice>
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<!--
Start a new Docker container.
Containers can be started in two modes:
- Short-running containers:
These are started with a timeout.
Their output is visible in the next iteration.
- Long-running containers:
These are started with a name.
They are added to the container list.
Their output is queried using the read_container_stdout and read_container_stderr actions.
Either a name or a timeout must be specified.
-->
<xs:element name="start_container">
<xs:complexType>
<!-- Docker image to use -->
<xs:attribute name="image" type="xs:string" use="required"/>
<!-- Container name for long-running containers -->
<xs:attribute name="name" type="xs:string" use="optional"/>
<!-- Timeout in milliseconds for short-running containers -->
<xs:attribute name="timeout" type="xs:integer" use="optional"/>
<!-- Stop command terminates the agent gracefully -->
<xs:element name="stop">
<xs:complexType/>
</xs:element>
<!-- Background script that runs continuously without blocking the agent
Output is captured and stored in working memory -->
<xs:element name="background">
<xs:complexType mixed="true">
<xs:sequence>
<!-- Main command to run in container -->
<xs:element name="command" type="xs:string" minOccurs="0"/>
<!-- Command line arguments to the main command -->
<xs:element name="argument" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<!-- Volume mappings from host to container -->
<xs:element name="volumes" minOccurs="0">
<xs:complexType>
<xs:sequence>
<!--
Each volume maps host path to container path.
Syntax similar to -v switch of docker run command.
using : separator and optional :ro flag.
-->
<xs:element name="volume" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Port mappings from host to container -->
<xs:element name="ports" minOccurs="0">
<xs:complexType>
<xs:sequence>
<!-- Each port maps a host port to a container port -->
<xs:element name="port" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="host" type="xs:string" use="required"/>
<xs:attribute name="container" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Environment variables to set in the container -->
<xs:element name="environment" minOccurs="0">
<xs:complexType>
<xs:sequence>
<!-- Each variable has a name and value -->
<xs:element name="variable" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Write data to a container's standard input -->
<xs:element name="write_container_stdin">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<!-- Name of the target container -->
<xs:attribute name="container" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
<!-- Repeat script that runs on every iteration
Output is refreshed each time and stored in working memory
Useful for monitoring files or system state -->
<xs:element name="repeat">
<xs:complexType mixed="true">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Read from a container's standard output buffer -->
<xs:element name="read_container_stdout">
<xs:complexType>
<!-- Name of the container to read from -->
<xs:attribute name="container" type="xs:string" use="required"/>
<!-- Optional number of bytes to read (-1 for all available) -->
<xs:attribute name="n" type="xs:integer" use="optional"/>
<!-- Single shot script that runs once and completes
Output is stored in working memory until explicitly deleted
Used for one-time operations like file manipulation -->
<xs:element name="single_shot">
<xs:complexType mixed="true">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Read from a container's standard error buffer -->
<xs:element name="read_container_stderr">
<xs:complexType>
<!-- Name of the container to read from -->
<xs:attribute name="container" type="xs:string" use="required"/>
<!-- Optional number of bytes to read (-1 for all available) -->
<xs:attribute name="n" type="xs:integer" use="optional"/>
<!-- Reasoning documents the agent's thought process
Stored in working memory for context and learning
Can be referenced by future iterations to improve decisions -->
<xs:element name="reasoning">
<xs:complexType mixed="true">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!--
Wait for a container to finish execution.
Standard output and standard error are merged and visible in the next iteration.
-->
<xs:element name="wait_container">
<xs:complexType>
<!-- Name of the container to wait for -->
<xs:attribute name="name" type="xs:string" use="required"/>
<!-- Maximum time to wait in milliseconds -->
<xs:attribute name="timeout" type="xs:integer" use="required"/>
<!-- Read stdin command retrieves input from the IO buffer
Blocks until input is available
Input is stored in working memory as a ReadEntry -->
<xs:element name="read_stdin">
<xs:complexType/>
</xs:element>
<!-- Write stdout command sends output to the IO buffer
Output is stored in working memory as a WriteEntry
Used for communicating with users or other processes -->
<xs:element name="write_stdout">
<xs:complexType mixed="true">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Switch to a different LLM model file -->
<xs:element name="set_model_path">
<xs:complexType>
<xs:simpleContent>
<!-- Path to the model file to load -->
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
</xs:schema>