Moving AI Agent Logic to YAML: Run from Telegram, VS Code, and CLI

One developer got tired of writing TypeScript tools for every connector in OpenClaw (Postgres, SSH, Slack, etc.). His solution: move the agent business logic into a agent.yaml file and run it via OE Runtime as an HTTP server. OpenClaw's SKILL.md points at that server, and the same YAML now works from Telegram, VS Code, and the CLI — no code duplication.
Architecture
The flow looks like this:
User message in Telegram → OpenClaw calls POST /run-file → OE Runtime executes agent.yaml → result back in Telegram
Agent Definition in YAML
Instead of writing TypeScript for each tool, the agent is defined declaratively:
name: Database Analyst
instructions: |
You are a database analyst...
steps:
- name: Query
content: List all tables and row counts
connectors:
- connection_name: My Database
connection_type: postgresql
Why This Works
The key side effect: the same agent.yaml runs from VS Code, CLI, and HTTP. No duplication. This separates the agent logic from the UI layer and makes it portable across surfaces.
Who This Is For
If you're building with OpenClaw and want to reduce TypeScript boilerplate, or need your agent to run in multiple environments (chat, IDE, terminal), this pattern is worth a look.
📖 Read the full source: r/openclaw
👀 See Also

Explore Real-World Applications with r/OpenClawUseCases!
Dive into real-world AI applications with r/OpenClawUseCases. Discover user-generated content on AI coding agents, automation, and more.

Parallel Execution for Claude AI Agents Achieved with Distributed System Approach
A developer successfully ran 41 Claude AI agents in parallel with zero conflicts and 58% time savings by treating agents as a distributed system with hard-scoped responsibilities rather than a group chat.

Building Vertical Data Layers for OpenClaw Agents
The real opportunity with OpenClaw isn't just using it—it's building industry-specific data layers that connect messy data sources, normalize them into usable schemas, and expose them as clean tool endpoints that return structured JSON.

Using Claude Haiku as a Gatekeeper to Reduce Sonnet API Costs by 80%
A developer built a two-stage pipeline using Claude Haiku to filter out 85% of unstructured text before sending only relevant content to Claude Sonnet, reducing API costs by approximately 80% when processing thousands of comments.