Introducing Confident Voice: Watch the Launch Video Now

Agent Handler Skill

Teach your agent to connect an app with no HTTP endpoint through the Confident Agent's handler mode.

Overview

The confident-agent-handler Agent Skill teaches your coding agent how to connect an AI app that has no HTTP endpoint to Confident AI through Handler Mode. The agent finds your pipeline in your code, writes a small handler function that calls it, gives you the command to run the Confident Agent beside it, then creates an Agent Handler AI connection and pings it until it works.

GitHub Repository

View the source code, report issues, and find the latest releases.

The handler is the only file added to your codebase. Your pipeline runs where it already does: the agent dials out to Confident AI, receives each input over that outbound connection, and calls your handler in-process, so nothing is inbound and your code never leaves your network.

When It Triggers

The skill activates on prompts like:

Prompts that trigger the skill
Connect our summarization pipeline to Confident AI. It has no API.
Set up handler mode so Confident AI can red team our internal agent.
Write a Confident Agent handler for the notebook in research/.
Our Agent Handler connection fails its ping, figure out why and fix it.

Installation

Works with Cursor, Claude Code, Codex, Windsurf, OpenCode, and any other Skills-compatible assistant:

npx skills add confident-ai/confident-skills --skill "confident-agent-handler"

Prerequisites

  • An Enterprise plan with a project API key for the agent, in CONFIDENT_API_KEY. The agent never sees it: it writes the run command with a placeholder for you to fill in.
  • Outbound access on port 443 from the machine running the agent, and a runtime where your pipeline is importable.
  • The Confident AI MCP server connected to your coding agent, so it can create and ping the connection. Without it, the agent walks you through those two steps in the dashboard instead.

What Happens in Your Project

  1. Ask for a connection

    The agent calls list_projects to find the project to work in, then list_ai_connections, so it fixes an existing Agent Handler connection instead of creating a duplicate.

    Prompt
    Connect our summarization pipeline to Confident AI. It has no API.
  2. Write the handler

    The agent finds the function that turns an input into your app's answer and writes a handler beside it in the same language (Python, TypeScript, Go, Java, or Rust). The handler imports your pipeline, calls it, and returns a Response with the output, plus the retrieval context and tools called when your pipeline has them.

    See what the agent writes
    confident_handler.py
    from confident_agent import handler, Request, Response
    from my_company.pipeline import summarize
    
    @handler
    def summarize_handler(request: Request) -> Response:
        return Response(
            output=summarize(request.input, request.context),
        )
  3. Run the agent

    The agent installs confident-agent into your pipeline's own environment and gives you the command to start it, with your project API key as a placeholder:

    CONFIDENT_API_KEY=<your-api-key> confident-agent --handler confident_handler.py

    There is no URL or port to configure. Once it connects, the connection status shows Agent connected.

  4. Create the connection and ping it

    The agent creates the connection with create_ai_connection and type: "AGENT_HANDLER". There is no endpoint, payload, or output key path to set, because Response fields are mapped automatically.

    See what the agent sends
    create_ai_connection
    {
      "name": "Summarization pipeline",
      "type": "AGENT_HANDLER"
    }

    It then calls ping_ai_connection, which sends one sample input through the tunnel and runs your handler. If the ping fails, the agent reads the error, fixes the handler or how the agent runs, and pings again until it passes.

    Prompt
    Our Agent Handler connection fails its ping, figure out why and fix it.

FAQs

Does the skill change my code?

It adds one handler file next to your pipeline and installs the confident-agent package. It doesn't change your pipeline: the handler only calls it.

My app has an internal endpoint. Should I use this?

No. Use confident-eval-setup, and for an endpoint behind a firewall, the Confident Agent in its default forwarding mode.

Does it work without the MCP server?

Yes. The agent still writes the handler and the run command, then gives you the dashboard steps: create the AI connection, pick Agent Handler as the response mode, and click Ping.

What about languages without a handler SDK?

For Clojure, Elixir, and other languages without a native SDK, the agent points you to the fallback: a small local endpoint plus the Confident Agent's forwarding mode, connected with confident-eval-setup.

Next Steps

Scaling beyond prototype?For teams evaluating Confident AI in productionTalk to us

Last updated on

Built byConfident AI