CoFounder.im
Overview API Docs MCP Docs

rerun_agent

WRITE

Re-run a completed agent with optional feedback. Returns stale downstream agents.

The rerun_agent tool re-queues a previously completed agent so it runs again, optionally incorporating user feedback via the user_notes parameter.

When to use: Use this when an agent’s output does not meet expectations. For example, if the market research missed a key competitor segment or the tech stack recommendation used an unfamiliar framework. Provide specific feedback in user_notes to guide the re-run.

Downstream staleness: Re-running an agent may invalidate outputs from downstream agents that depended on it. The response includes a stale_downstream_agents list of completed agents whose outputs may now be outdated. You can re-run those individually using additional rerun_agent calls if needed.

Requirements: the agent must have been run at least once on the project, must currently have status completed (not pending or processing), and you must have enough credits for the re-run cost.

The re-run preserves the agent’s previous output as context so the model can understand what to improve.

Only agents with status completed can be re-run. Check stale_downstream_agents in the response and re-run those if their outputs are still needed downstream.

Parameters

Name Type Required Description
project_id string Required The UUID of the project.
Example: 550e8400-e29b-41d4-a716-446655440000
agent_type string enum Required The type of agent to re-run.
Example: market_research
user_notes string Optional Optional feedback or adjustments for the agent to consider on re-run. Be specific about what to improve.
Example: Focus more on the enterprise segment and include pricing comparison with Workday and SAP SuccessFactors.

Response Example

{
  "agent": {
    "agent_type": "market_research",
    "title": "Market Research",
    "cost": 120,
    "status": "queued"
  },
  "stale_downstream_agents": [
    {"agent_type": "go_to_market", "title": "Go-to-Market Strategy"},
    {"agent_type": "pitch_deck_generator", "title": "Pitch Deck Generator"}
  ],
  "credits_remaining_after": 2330
}

Errors

Scenario Error Message
Project does not exist or belongs to another user Error: Project not found
Agent has never been run on this project Error: Agent 'market_research' has not been run on this project yet.
Agent is not in completed state (e.g. still processing) Error: Agent 'market_research' is currently 'processing'. Only completed agents can be re-run.
Not enough credits for the re-run Error: Insufficient credits. Need 120, have 50. Top up your credits: - Starter Pack: 500 credits for $9.00
Database error when updating the agent record Error: Failed to update agent for re-run. Please try again.

Code Examples

curl -X POST https://mcp.cofounder.im/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "rerun_agent",
      "arguments": {"project_id": "550e8400-e29b-41d4-a716-446655440000", "agent_type": "market_research", "user_notes": "Focus more on the enterprise B2B segment."}
    }
  }'
{:ok, response} =
  Req.post("https://mcp.cofounder.im/mcp",
    json: %{
      "jsonrpc" => "2.0",
      "id" => 1,
      "method" => "tools/call",
      "params" => %{
        "name" => "rerun_agent",
        "arguments" => %{"project_id" => "550e8400-e29b-41d4-a716-446655440000", "agent_type" => "market_research", "user_notes" => "Focus more on the enterprise B2B segment."}
      }
    },
    headers: [
      {"content-type", "application/json"},
      {"authorization", "Bearer YOUR_API_KEY"}
    ]
  )

response.body["result"]["content"]
|> hd()
|> Map.get("text")
|> IO.puts()
import requests

response = requests.post(
    "https://mcp.cofounder.im/mcp",
    headers={
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_API_KEY",
    },
    json={
        "jsonrpc": "2.0",
        "id": 1,
        "method": "tools/call",
        "params": {
            "name": "rerun_agent",
            "arguments": {"project_id": "550e8400-e29b-41d4-a716-446655440000", "agent_type": "market_research", "user_notes": "Focus more on the enterprise B2B segment."},
        },
    },
)
data = response.json()
print(data["result"]["content"][0]["text"])
const response = await fetch("https://mcp.cofounder.im/mcp", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer YOUR_API_KEY",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "tools/call",
    params: {
      name: "rerun_agent",
      arguments: { project_id: "550e8400-e29b-41d4-a716-446655440000", agent_type: "market_research", user_notes: "Focus more on the enterprise B2B segment." },
    },
  }),
});

const data = await response.json();
console.log(data.result.content[0].text);

Try It

This sends a real request to your account.