Skip to main content
AI-powered workflow steps using Large Language Models.

Overview

Osmedeus provides three step types for LLM integration:
  • llm — Single-shot LLM calls: chat completions, tool calling, embeddings, multimodal content, structured outputs
  • agent — Agentic execution loop: iterative tool calling, sub-agents, memory management, planning stages, multi-goal execution
  • agent-acp — External AI agent execution via the Agent Communication Protocol (ACP): delegates to real agent binaries (Claude Code, Codex, OpenCode, Gemini)

Configuration

Settings

In osm-settings.yaml, configure one or more providers under llm_providers. Providers are rotated automatically across requests:

Environment Variables

Environment variables override settings for the default provider:

Chat Completion

Basic Usage

Export variables are based on the sanitized step name (hyphens replaced with underscores). A step named analyze-results produces exports analyze_results_llm_resp (full response object) and analyze_results_content (text content only).

Message Roles

Multi-turn Conversation

Tool Calling

Define Tools

Handle Tool Calls

Tool calls are exported within the _llm_resp object:

Embeddings

Generate Embeddings

Use with Files

Structured Output

JSON Schema

Configuration Override

Per-Step Config

Extra Parameters

Multimodal Content

Image Analysis

Streaming

Both llm and agent steps support streaming output via the stream field:
The stream field overrides both llm_config.stream and the global config setting.

Agent Step Type

The agent step type provides an agentic LLM execution loop — the LLM iteratively calls tools, processes results, and reasons until completion. This is fundamentally different from the single-shot llm step.

Basic Agent

Either query (single goal) or queries (multi-goal) is required, not both.

Preset Tools

Preset tools reference built-in osmedeus functions with auto-generated schemas:

Custom Tools

Define custom tools with explicit schemas and JavaScript handlers:
The handler is a JavaScript expression. The parsed tool call arguments are available as the args object.

Multi-Goal Execution

Use queries to run the agent through multiple goals sequentially. Each goal is executed in order, and all results are collected:
The agent_goal_results export contains results from all goals as a JSON array.

Planning Stage

Add a planning phase before the main execution loop. The agent first generates a plan, then executes it:

Memory Management

Control conversation context size for long-running agents:

Model Preferences

Specify preferred models tried in order. Falls back to the default provider config if none are available:

Structured Output (Agent)

Enforce a JSON schema on the agent’s final output using output_schema:
The schema is enforced on the final iteration via the OpenAI response_format parameter.

Sub-Agents

Define inline sub-agents that the parent agent can spawn via the auto-generated spawn_agent tool:
When sub_agents is defined, a spawn_agent tool is automatically added with parameters:
  • agent — Name of the sub-agent to spawn (from the defined list)
  • query — The task to delegate
Sub-agents support recursive nesting (sub-agents can define their own sub_agents). Use max_agent_depth to control nesting depth (default: 3).

Stop Condition

A JavaScript expression evaluated after each iteration. If it returns true, the agent stops:
Available variables in the expression: agent_content (current response text), iteration (current iteration number).

Tool Tracing Hooks

JavaScript expressions executed before and after each tool call for logging or debugging:

Parallel Tool Calls

By default, agents allow the LLM to make multiple tool calls in parallel. Disable this for sequential execution:

Agent Exports

All exports available from agent steps:

Agent-ACP Step Type

The agent-acp step type spawns an external AI coding agent as a subprocess and communicates via the Agent Communication Protocol (ACP). Unlike the agent step type (which uses Osmedeus’s internal LLM loop), agent-acp delegates to real agent binaries like Claude Code, Codex, OpenCode, or Gemini.

Basic Agent-ACP

Built-in Agents

Four agents are available out of the box: List available agents from the CLI:

Configuration Fields

agent is required unless acp_config.command is provided to specify a custom agent binary.

ACP Config

Override the built-in agent or customize execution:

Full Configuration Example

Custom Agent

Use acp_config.command to run any ACP-compatible agent binary:

Agent-ACP Exports

Agent CLI Command

Run an ACP agent interactively from the terminal:

run_agent Utility Function

Use run_agent in function steps to invoke an ACP agent programmatically:

API Endpoints

LLM API

OpenAI-compatible API:

Agent ACP API

OpenAI-compatible endpoint that spawns a local ACP agent subprocess:
The model field maps to the agent name (claude-code, codex, opencode, gemini). Defaults to claude-code if unrecognized.
Only one ACP agent subprocess can run at a time via the API. Concurrent requests return HTTP 409.

Providers

OpenAI

Anthropic

Ollama (Local)

Azure OpenAI

Multiple Providers (Rotation)

Configure multiple providers for automatic rotation:

Workflow Functions

Use LLM functions directly in function steps without the full llm step type.

llm_invoke

Simple LLM call with a direct message:

llm_invoke_custom

LLM call with a custom POST body template. Use {{message}} as a placeholder:

llm_conversations

Multi-turn conversation using role:content format:

Use Cases

Vulnerability Analysis

Report Generation

Intelligent Filtering

Autonomous Reconnaissance Agent

Delegated Code Analysis (Agent-ACP)

Best Practices

  1. Use system prompts for consistent behavior
  2. Limit context size — summarize large inputs before passing to LLM
  3. Set max_iterations appropriately — higher for complex tasks, lower for simple queries
  4. Enable memory management for long-running agents to avoid context overflow
  5. Use structured output when you need to parse the response programmatically
  6. Consider local models (Ollama) for sensitive data that shouldn’t leave your network
  7. Use sub-agents to decompose complex tasks into specialized subtasks
  8. Add stop_condition when the agent has a clear success criteria
  9. Use plan_prompt for complex tasks that benefit from upfront planning
  10. Use agent-acp when you need full coding agent capabilities (file editing, code generation) — use agent when you need fine-grained tool control within the osmedeus ecosystem
  11. Restrict allowed_paths in agent-acp steps to limit file access to the workspace
  12. Keep write_enabled: false (default) in agent-acp unless the agent needs to create files

Next Steps