API_REFERENCE
REFERENCEDetailed documentation for the AKIOS SDK classes, interfaces, and CLI commands.
CLI_COMMANDS#
The AKIOS CLI is your primary tool for managing local development and edge deployments.
| COMMAND | DESCRIPTION |
|---|---|
| AKIOS init | Scaffolds a new agent project with TypeScript and Zod. |
| AKIOS dev | Starts a local hot-reloading server at localhost:3000. |
| AKIOS deploy | Bundles and pushes your agent to the AKIOS Edge Runtime. |
| AKIOS logs | Streams live logs from production instances. |
| AKIOS secrets | Manage encrypted environment variables. |
CLASS_AGENT#
The Agent class orchestrates the loop between the LLM, tools, and memory. It manages the complete agent lifecycle from input to response.
CONSTRUCTOR_OPTIONS
| Prop | Type | Description |
|---|---|---|
nameReq | string | Unique identifier for the agent. Used for logging and memory partitioning. |
modelReq | string | ModelProvider | The LLM to use. Can be a string ID (e.g. "gpt-4") or a configured provider instance. |
tools | Tool[] Default: [] | Array of Tool instances available to the agent. |
systemPrompt | string Default: "You are a helpful assistant." | The base instructions for the agent behavior. |
memory | MemoryStore Default: InMemoryStore | Persistence layer for conversation history. |
temperature | number Default: 0.7 | Sampling temperature (0.0 to 1.0). |
maxSteps | number Default: 10 | Maximum number of thought/action loops before forced termination. |
maxTokens | number Default: 4096 | Maximum tokens per response. |
timeout | number Default: 30000 | Request timeout in milliseconds. |
guardrails | Guardrail[] Default: [] | Input/output validation rules. |
debug | boolean Default: false | Enable detailed logging and tracing. |
METHODS
Executes the agent loop with the given input. Returns the final text response and trace metadata.
Generates a stream of events (thought, tool_call, tool_result, answer) for real-time UI updates.
Pauses execution at the next safe point. Useful for human-in-the-loop workflows.
Resumes execution after a pause, continuing from the last safe state.
EXAMPLE
CLASS_TOOL#
Tools allow agents to interact with the outside world. Each tool defines a function that the LLM can call with structured arguments.
CONSTRUCTOR_OPTIONS
| Prop | Type | Description |
|---|---|---|
nameReq | string | The function name exposed to the LLM (e.g. "get_weather"). Must be snake_case. |
descriptionReq | string | Natural language description of what the tool does and when to use it. |
schemaReq | z.ZodSchema | Zod schema defining the input arguments. Used for validation and JSON Schema generation. |
handlerReq | (args: T) => Promise<any> | The implementation function. Receives validated arguments. |
dangerous | boolean Default: false | If true, requires human approval before execution in production environments. |
timeout | number Default: 10000 | Maximum execution time in milliseconds. |
retries | number Default: 3 | Number of retry attempts on failure. |
METHODS
Executes the tool with the given arguments. Validates input against the schema before calling the handler.
Returns the JSON Schema representation of the tool's input parameters for LLM consumption.
EXAMPLES
WEATHER_TOOL
DATABASE_QUERY_TOOL
INTERFACE_MODEL_PROVIDER#
Implement this interface to connect AKIOS to custom LLMs or local inference servers.
INTERFACE_MEMORY_STORE#
Memory stores persist conversation history and context across agent runs. Implement this interface for custom storage backends.
BUILT_IN_IMPLEMENTATIONS
InMemoryStore- Simple in-memory storage (development only)RedisStore- Redis-backed persistence with TTLPostgresStore- PostgreSQL with full-text searchDynamoDBStore- AWS DynamoDB for serverless deployments
EXAMPLE_CUSTOM_MEMORY_STORE
ERROR_TYPES#
AKIOS defines specific error types for different failure modes. All errors extend the base AKIOSError class.
ValidationError
Thrown when tool arguments don't match the schema or input validation fails.
ToolExecutionError
Thrown when a tool handler fails during execution.
GuardrailViolationError
Thrown when input or output violates a safety policy.
MaxStepsExceededError
Thrown when an agent exceeds the maximum allowed execution steps.
HTTP_API_ENDPOINTS#
When deployed, AKIOS exposes REST endpoints for agent interaction. All endpoints require authentication.
AGENT_EXECUTION
Execute an agent synchronously and return the final response.
Execute an agent with Server-Sent Events streaming.
MEMORY_MANAGEMENT
List all conversation IDs for an agent.
Retrieve the full conversation history.
Delete a conversation and its history.
CONFIGURATION_&_ENVIRONMENT#
AKIOS can be configured via environment variables, configuration files, or programmatic options.
ENVIRONMENT_VARIABLES
| Variable | Description | Default |
|---|---|---|
| AKIOS_LOG_LEVEL | Logging verbosity (error, warn, info, debug) | info |
| AKIOS_MAX_MEMORY_MB | Maximum memory usage before garbage collection | 512 |
| AKIOS_REQUEST_TIMEOUT | HTTP request timeout in milliseconds | 30000 |
| AKIOS_RATE_LIMIT_RPM | Requests per minute limit | 60 |
| AKIOS_ENABLE_METRICS | Enable Prometheus metrics collection | false |
| AKIOS_STORAGE_BACKEND | Memory store backend (redis, postgres, dynamodb) | memory |
| AKIOS_REDIS_URL | Redis connection URL | redis://localhost:6379 |
| AKIOS_DATABASE_URL | PostgreSQL connection string |
CONFIGURATION_FILE
Create an akios.config.js or akios.config.ts file in your project root for advanced configuration.