Tool Calling with /completions
Cadreen's tool calling is hybrid: some tools execute server-side with governance, others pass through to the client.
How tools work
You send tool definitions in the request. The model proposes tool calls. Cadreen evaluates governance on every call — both client and Cadreen tools. After governance approves, Cadreen tools execute server-side while client tools are returned to you for local execution.
The hybrid execution flow
When you ask "read main.go and email a summary to john@example.com", Cadreen splits the work:
Tool chaining
When the model proposes tool calls, you execute them and send results back:
# First request — model proposes tools
response = client.chat.completions.create(
model="cadreen",
messages=[{"role": "user", "content": "List my connectors and summarize them"}],
tools=[...]
)
# Get tool calls
tool_calls = response.choices[0].message.tool_calls
# Execute tools locally, then send results back
messages = [
{"role": "user", "content": "List my connectors and summarize them"},
response.choices[0].message,
{
"role": "tool",
"tool_call_id": tool_calls[0].id,
"content": '{"connectors": ["stripe", "salesforce", "github"]}'
}
]
# Second request — model sees tool results
response2 = client.chat.completions.create(
model="cadreen",
messages=messages,
tools=[...]
)conversation_id to track conversations across requests. Tool call confirmations (when governance blocks a call) are matched to the correct conversation via this ID.Self-healing
When a tool call fails, Cadreen diagnoses the failure and retries:
Governance on tool calls
When governance blocks a tool call, the response contains text asking for confirmation instead of a tool call:
{
"choices": [{
"message": {
"role": "assistant",
"content": "I need your approval before I can process_refund.\n\nSay \"yes\" to proceed or \"no\" to skip."
},
"finish_reason": "stop"
}]
}Discovering available tools
Cadreen's tools are discovered from the capability graph. Use GET /api/v1/cadreen/tools to list all available tools for your workspace.
curl https://accomplishanything.today/api/v1/cadreen/tools \
-H "Authorization: Bearer sk_cadreen_..."Returns OpenAI function definitions ready to use in your request.