LiteLambda AI Agents
LiteLambda AI Agents are multi-turn autonomous agents powered by Pydantic AI running inside hardened, isolated Docker containers. With zero infrastructure setup, you can deploy agents that run custom Python tools, leverage domain skills, execute on cron schedules, and interact with your team via 2-way bot channels on Slack, Telegram, Discord, and Webhooks.
1. Sandbox Specifications & Hardware Limits
Every LiteLambda AI Agent executes inside a secure, dedicated Docker sandbox. To ensure deterministic performance and prevent runaway resource costs, sandbox hardware limits are strictly fixed:
| Resource | Specification | Description |
|---|---|---|
| Memory (RAM) | 128 MB | Hard cgroup memory limit (--memory=128m). Non-configurable. |
| Compute (vCPU) | 0.25 vCPU | CPU quota of 25,000 / 100,000 periods (--cpus=0.25). Non-configurable. |
| Execution Timeout | 90 – 120 seconds | Default: 100s. Values outside 90–120s are automatically clamped. |
| Billing / Cost | Flat 5 credits | Deducted from your wallet per completed agent run, regardless of tool rounds. |
| File System | Read-Only Rootfs | Root filesystem is mounted read-only with an ephemeral 64MB tmpfs at /tmp. |
| Network Security | RFC1918 Lockdown | Outbound access to public internet only; all private LAN/VPC CIDRs (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) are blocked via iptables. |
| User Privileges | Unprivileged | Runs as non-root nobody:nogroup (UID 65534) with all Linux capabilities dropped (--cap-drop=ALL). |
2. Agent Project Structure
An agent is defined by a clean, self-contained bundle of files:
my-agent/
├── agent.yaml # Identity, system instructions, model config & limits
├── tools.py # Custom Python tools exported in a `tools` list
├── requirements.txt # (Optional) Extra pip packages installed into a cached layer
└── skills/ # (Optional) Domain markdown/YAML procedures
└── devops-audit/
└── SKILL.md
3. agent.yaml Schema Reference
The agent.yaml manifest defines the agent's identity, system prompt instructions, LLM provider, and tool calling limits.
Complete Example
name: cluster-triage-agent
description: Autonomous Kubernetes and service health remediation controller
instructions: |
You are an operations triage agent. When an alert fires:
1. Inspect cluster status using `check_cluster_health`.
2. If remediation is needed, draft a remediation plan and call `restart_deployment`.
3. Always adhere to human approval gates for disruptive actions.
model:
provider: openai # openai | anthropic | openrouter | groq | openai-compatible | test
name: gpt-4o-mini # Model identifier
base_url: https://... # Optional base URL (required for openai-compatible)
api_key_env: OPENAI_API_KEY # Env var containing your API key (BYOK)
limits:
max_tool_rounds: 6 # Max iterative tool call loops (1–20, default: 6)
run_timeout_seconds: 100 # Timeout clamped between 90 and 120 seconds
Supported Model Providers
- OpenAI (
openai):gpt-4o-mini,gpt-4o,o1-mini,o3-mini. Uses yourOPENAI_API_KEY. - Anthropic (
anthropic):claude-3-5-sonnet-latest,claude-3-5-haiku-latest. Uses yourANTHROPIC_API_KEY. - OpenRouter (
openrouter): Any OpenRouter model identifier (e.g.anthropic/claude-3.5-sonnet). UsesOPENROUTER_API_KEY. - Groq (
groq):llama-3.3-70b-versatile,mixtral-8x7b-32768. UsesGROQ_API_KEY. - OpenAI Compatible (
openai-compatible): Together AI, Ollama, DeepSeek, or internal LLM gateways. Specifybase_urlin config. - Mock Provider (
test):test-modelgenerates deterministic tool calls without consuming external API tokens.
4. Authoring Python Tools (tools.py)
Under the hood, LiteLambda inspects your Python functions using Pydantic AI. Function arguments, type annotations, and docstrings are automatically translated into tool schemas for the LLM.
Rules for tools.py:
- Every tool must have Python type hints (
str,int,float,bool,list,dict, or PydanticBaseModel). - Every tool must have a clear docstring explaining what the tool does and what its parameters mean.
- You must export a list named
tools:tools = [fn1, fn2].
Human-in-the-Loop Approval Gates (requires_approval = True)
For destructive, financial, or sensitive actions, tag the function with requires_approval = True. When the agent decides to invoke this tool, execution pauses and sends an interactive approval request to your connected channels (Slack, Telegram, Discord, Web Studio).
from typing import Dict, Any
def check_cluster_health(cluster_id: str) -> Dict[str, Any]:
"""Inspects cluster nodes and active pods.
Args:
cluster_id: The identifier of the cluster to inspect.
"""
return {"cluster": cluster_id, "status": "degraded", "pods_failing": ["auth-worker-2"]}
def restart_deployment(cluster_id: str, deployment: str) -> str:
"""Restarts a failing deployment. Requires human approval before executing."""
# This code only runs after a human clicks 'Approve' in Slack/Telegram/Discord
return f"Deployment '{deployment}' in cluster '{cluster_id}' restarted successfully."
# Human-in-the-Loop Gate:
restart_deployment.requires_approval = True
# Export all active tools:
tools = [check_cluster_health, restart_deployment]
5. 2-Way Bot Channels (Slack, Telegram, Discord, Webhooks)
LiteLambda AI Agents feature native 2-way bot integrations. Your team can chat with the agent in group channels or direct messages, and receive interactive approval cards with Approve and Reject buttons.
| Channel | Setup Requirement | Interaction Style |
|---|---|---|
| Slack | Bot Token (xoxb-...), App-level token, or OAuth in Web Studio |
Slash commands, @mentions, and interactive Block Kit buttons. |
| Telegram | Bot Token from @BotFather |
DMs and group chats with Inline Keyboard buttons. |
| Discord | Bot Token & Application ID | Server channels with Discord action components. |
| Webhook | Automatic per-agent HTTPS endpoint | Inbound JSON triggers for CI/CD and external systems. |
Security Note: 2-way bot credentials and OAuth handshakes are managed securely in the LiteLambda Web Studio (
/agents/<id>/?tab=channels) to protect secrets and verify scopes.
6. Execution Modes & Triggers
Agents can be run in three ways:
- Interactive Prompts via API or MCP:
Trigger an agent on demand from your terminal, CI/CD pipeline, Cursor, Claude Desktop, or custom script:
bash curl -X POST https://litelambda.in/api/v1/agents/<agent_name>/trigger/ \ -H "Authorization: Bearer $LITELAMBDA_TOKEN" \ -H "Content-Type: application/json" \ -d '{"prompt": "Audit cluster auth-prod and report status", "session_id": "session-1"}' - Scheduled Crons:
Setcron_schedule(e.g.0 9 * * *) andcron_promptin your agent settings. The agent will wake up autonomously, execute its prompt and tools, and log results. - Conversational Chat:
Talk directly with your agent inside Slack, Discord, or Telegram. Conversation history is automatically preserved across turns.
7. Model Context Protocol (MCP) Integration
LiteLambda exposes agent management directly to AI coding tools (Claude, Cursor, Antigravity) via https://mcp.litelambda.in/mcp:
list_agents(): View all active agents, model providers, and channel status.get_agent(name_or_id): Retrieve full configuration,agent.yaml,tools.py, and skills.deploy_agent(name, instructions, ...): Deploy or update an agent programmatically.trigger_agent(name_or_id, prompt, session_id): Dispatch tasks to the agent sandbox.get_agent_run(run_id): Retrieve real-time execution logs, tool traces, and LLM responses.delete_agent(name_or_id): Soft or hard delete an agent and clean up background crons.list_agent_channels(name_or_id): Inspect connected bot channels.get_litelambda_docs(topic="agents"): Dynamically loads this documentation directly from the LiteLambda documentation engine.
8. Frequently Asked Questions (FAQ)
What framework powers LiteLambda AI Agents?
LiteLambda AI Agents are powered natively by Pydantic AI (pydantic_ai.Agent). All Pydantic AI features including type validations, structured outputs, multi-turn history, and tool docstrings are supported out of the box.
Can I customize the agent's RAM or CPU limits?
No. All LiteLambda agent sandboxes run with fixed 128 MB RAM, 0.25 vCPU, and a 90–120s execution timeout. This guarantees predictable container scheduling, deterministic costs, and rock-solid multi-tenant isolation.
How much does it cost to run an agent?
Agent executions are billed at a flat rate of 5 credits per run, regardless of the number of tool iterations or LLM turns during that execution.
How does human approval work in Slack or Discord?
When an agent calls a function tagged with fn.requires_approval = True, LiteLambda pauses execution and posts an interactive card to your designated channel. Team members can inspect the arguments and click Approve or Reject. Upon approval, the function executes and returns the output to the agent to complete the task.