Beddel facilitates the creation of secure and extensible agent runtimes through declarative YAML workflows. Its design empowers developers to define intelligent agents that process inputs and execute actions seamlessly, while ensuring security through strict parsing and execution controls.
Beddel provides a security-first toolkit designed for developers seeking to implement agent runtimes with a focus on secure parsing and execution. Built upon a hardened YAML parser, it ensures that only the YAML FAILSAFE schema is exposed, leveraging isolated-vm to support multiple execution strategies while maintaining compliance with stringent security measures.
Secure YAML Parsing: Utilize the SecureYamlParser to enforce depth, size limits, and UTF-8 validation while parsing YAML documents.
Isolated Execution: The IsolatedRuntimeManager allows for running code within sandboxed environments, stripping dangerous global variables and enforcing time and memory limits, thereby enhancing security.
Declarative Agent Utilities: Implement agents through YAML definitions. Beddel interprets these agents strictly, ensuring adherence to defined schemas while supporting variable mapping to structured responses.
Compliance Ready: Tools for GDPR and LGPD compliance, including anonymization helpers and audit trails, ensure that projects can meet global standards while operating.
Performance Monitoring and Autoscaling: Features like PerformanceMonitor and AutoScaler help manage execution metrics and suggest scaling actions based on usage patterns.
This example showcases how to define a simple agent using YAML:
# joker-agent.yaml
agent:
id: joker
protocol: beddel-declarative-protocol/v2.0
metadata:
name: Joker Agent
schema:
input:
type: "object"
properties: {}
required: []
output:
type: "object"
properties:
response:
type: "string"
required: ["response"]
logic:
workflow:
- name: generate-joke
type: genkit-joke
action:
type: joke
prompt: "Conte uma piada curta e original que funcione para qualquer público."
result: jokerResult
- name: deliver-response
type: output-generator
action:
type: generate
output:
response: "$jokerResult.texto"
Below is an example demonstrating YAML parsing with strict fail-safes:
import { SecureYamlParser } from "beddel";
const parser = new SecureYamlParser({
maxDepth: 200,
filename: "agent-manifest",
});
const manifest = parser.parseSecure(`
agent:
id: joker
schema:
input: {}
output: {}
logic:
workflow:
- name: noop
type: output-generator
action:
type: generate
output:
response: "lol"
`);
console.log(manifest.agent.id); // joker
Here is an example to execute JavaScript code within a secure runtime:
import { IsolatedRuntimeManager } from "beddel";
const runtimeManager = new IsolatedRuntimeManager();
const result = await runtimeManager.execute({
code: `
const secret = "sandboxed";
({ success: true, value: secret.length });
`,
securityProfile: "ultra-secure",
timeout: 2000,
});
if (!result.success) {
throw result.error;
}
console.log(result.result); // { success: true, value: 9 }
Beddel offers a robust framework for developing and managing secure agent runtimes, emphasizing security, compliance, and extensibility. The built-in utilities and defined workflows create a clear path for implementing declarative logic in various applications.
No comments yet.
Sign in to be the first to comment.