DedalusRunner is the core of the Dedalus SDK. It orchestrates local tools, local and remote MCP servers, streaming, and any model from any provider into a single agentic loop. Its core job is to mix and chain tool calls across those systems inside one run. Five lines of code, any agent you want.
Quick Example
from dedalus_labs import AsyncDedalus, DedalusRunner
client = AsyncDedalus()
runner = DedalusRunner(client)
result = await runner.run(
input="What's the weather in Tokyo?",
model="anthropic/claude-sonnet-4-20250514",
mcp_servers=["windsornguyen/open-meteo-mcp"],
max_steps=5,
)
print(result.final_output)
Parameters
Show Core
Show Core
string | Message[]
required
The user’s prompt or a list of messages. Use a string for single-turn requests; use a message list for multi-turn conversations.
string | string[]
required
Model(s) to use. Format:
provider/model-name (e.g., openai/gpt-4o,
anthropic/claude-sonnet-4-20250514). Pass a list for routing or fallback behavior.string
System prompt that defines the agent’s behavior and personality.
Message[]
Existing conversation history. Use with
result.to_input_list() for multi-turn conversations.Show Tools & MCP
Show Tools & MCP
Callable[]
Local Python/TS functions the model can call. Schema extracted automatically from type hints and docstrings. See Tools.
Credential[]
Credentials for MCP server authentication.
string | object
Control tool usage:
"auto"— Model decides (default)"none"— Disable tools"required"— Force tool use{"type": "function", "function": {"name": "..."}}— Force specific tool
Show Model Parameters
Show Model Parameters
float
Sampling temperature (0–2). Higher values increase randomness. Default varies by model.
integer
Maximum tokens in the response.
float
Nucleus sampling threshold (0–1). Alternative to temperature.
float
Penalize repeated tokens based on frequency (-2.0 to 2.0).
float
Penalize tokens that have appeared at all (-2.0 to 2.0).
object
Adjust likelihood of specific tokens. Maps token IDs to bias values (-100 to 100).
Show Output Control
Show Output Control
type | object
Enforce structured output. Pass a Pydantic model or JSON schema. See Structured Outputs.
boolean
default:"false"
Include model’s intent analysis in result.
Show Execution
Show Execution
Show Advanced
Show Advanced
PolicyInput
Runtime policies for dynamic model selection or behavior modification.
object
Attributes for agent routing and selection. Maps attribute names to float values.
object
Per-model attribute overrides. Maps model names to attribute dictionaries.
string[]
Restrict which models the agent can use.
boolean
default:"true"
Enforce strict model validation.
object[]
Input/output guardrail configurations.
Show Debugging
Show Debugging
Return Value
object
Response object returned by
runner.run().Show Properties
Show Properties
string
required
The final text response from the agent.
ToolResult[]
required
Results from local tool executions. Each contains
name, result, step, and optionally error.MCPToolResult[]
required
Results from MCP server tool calls.
string[]
required
Names of tools that were invoked during the run.
integer
required
Number of agentic loop iterations used.
Message[]
required
Full conversation history including tool calls. Useful for debugging or continuing conversations.
object[]
Model’s intent analysis (only present if
return_intent=true).string
Alias for
final_output.string
Alias for
final_output.Show Methods
Show Methods
method
Returns a copy of the conversation history for use in follow-up runs. Enables multi-turn conversations.
Multi-turn Chat
import asyncio
from dedalus_labs import AsyncDedalus, DedalusRunner
async def main():
client = AsyncDedalus()
runner = DedalusRunner(client)
messages: list[dict] = []
while True:
user_input = input("You: ").strip()
if not user_input:
break
messages.append({"role": "user", "content": user_input})
result = await runner.run(
model="openai/gpt-4o",
messages=messages,
)
messages = result.to_input_list()
print(f"Assistant: {result.final_output}\n")
asyncio.run(main())
Example Response
{
"final_output": "The weather in Tokyo is currently 18°C with clear skies.",
"tool_results": [],
"mcp_results": [
{
"name": "get_current_weather",
"result": {"temperature": 18, "conditions": "clear"},
"server": "windsornguyen/open-meteo-mcp"
}
],
"tools_called": ["get_current_weather"],
"steps_used": 2,
"messages": [...]
}
Next Steps
Tools
Define local functions the model can call.
MCP Servers
Connect to hosted MCP servers.
Structured Outputs
Validate responses against schemas.
Streaming
Stream responses as they generate.
