Build your first agent

This guide takes you from a connected datasource to a governed agent that answers a business question with evidence. You register the agent in Colrows, approve and seat a version, and run it on your own compute with the stock worker. You write no agent code. Allow about thirty minutes.

What you build.

An agent named revenue-analyst that runs one verified query, reads the rows, and returns an answer in which every finding cites the query execution behind it. Colrows checks that evidence before the run succeeds.

Before you start

  • An organization administrator account. An administrator holds every role of the agent control plane.
  • A datasource that is ready for AI. The Quickstart gets you there.
  • One verified query on that datasource. A governed agent never runs raw SQL. It runs the verified queries in its scope, so this tutorial needs one.
  • A machine with Python 3.11 or later, and a key for a model provider such as OpenAI or Anthropic.

The steps below show the admin API under /api/quorum/v1. These routes need a signed-in user's session; see HTTP API for how to authenticate. Each successful response wraps its result in payload. The Quorum area of the Colrows app has pages for Agents, Runs, Evaluation suites, Reviews, Approvals, and Actions, and the on/off switch is in Administration → Settings. Three steps of this guide have no page and use the API: the requireEvaluation setting, the worker client, and the start of a run.

Step by step

  1. Turn on the agent control plane

    The control plane is off until an administrator enables it. Read the settings, set enabled to true and requireEvaluation to false, and send the whole settings object back.

    GET /api/quorum/v1/settings
    PUT /api/quorum/v1/settings

    requireEvaluation is on by default, and then a version needs a passing evaluation before it can be approved. This guide turns it off to keep the first agent short. Turn it on again before you run agents in production.

  2. Register the agent

    POST /api/quorum/v1/agents
    { "agentKey": "revenue-analyst", "displayName": "Revenue analyst" }

    The response carries payload.agentId. You own the agent unless you name another owner.

  3. Write the spec

    The spec is the contract between the agent and your data. It names what the agent is for, what it can see, which tools it can call, whose access it uses, and when it runs.

    POST /api/quorum/v1/agents/<agentId>/versions
    {
      "spec": {
        "specVersion": 1,
        "agentKey": "revenue-analyst",
        "displayName": "Revenue analyst",
        "pattern": "ANALYST",
        "purpose": "Answer questions about revenue by region.",
        "instructions": "Use verified queries. Cite the execution behind every finding.",
        "semanticScope": {
          "datasourceIds": ["<datasource-id>"],
          "verifiedQueryIds": ["<verified-query-id>"],
          "assetVersionPolicy": "FOLLOW_LATEST"
        },
        "tools": {
          "colrows": ["searchSemanticEntities", "getSemanticEntities", "executeSQL",
                      "getSQLExecutionStatus", "getSQLExecutionResult",
                      "getRunContext", "reportSemanticGap"],
          "external": []
        },
        "identity": { "mode": "ON_BEHALF_OF_USER", "fallback": "DENY" },
        "triggers": [ { "kind": "ON_DEMAND" } ],
        "output": { "contract": "ANALYST_ANSWER", "contractVersion": 1 }
      }
    }

    ON_BEHALF_OF_USER means that a run reads data with the access and masking policies of the user who started it. Every field is described in the agent spec reference.

  4. Submit, approve, and seat the version

    POST /api/quorum/v1/agents/<agentId>/versions/<version>/submit
    POST /api/quorum/v1/agents/<agentId>/versions/<version>/review   { "decision": "APPROVE" }
    POST /api/quorum/v1/agents/<agentId>/versions/<version>/seat

    Use payload.version from the response of the previous step. Submission validates the spec and checks that every datasource and verified query in scope is active. Only the seated version runs.

  5. Create a worker client

    A worker is the software on your side that claims runs and executes them. It signs in with a worker client.

    POST /api/quorum/v1/worker-clients
    { "name": "first-worker", "agentIds": ["<agentId>"], "expiresAt": <epoch-milliseconds> }

    The response payload contains clientId and clientSecret. Copy the secret at once, because Colrows shows it only one time. expiresAt must be within one year.

  6. Run the stock worker on your compute

    pip install "colrows[agent,openai]"
    
    export COLROWS_URL=https://cloud.colrows.com
    export COLROWS_CLIENT_ID=... COLROWS_CLIENT_SECRET=...
    export COLROWS_MODEL=openai:gpt-5 OPENAI_API_KEY=...
    
    colrows quorum check   # checks the URL, the credentials, and the scope, and takes no run
    colrows quorum serve

    The worker runs the default loop for every agent that the worker client serves. Your model provider key stays on this machine. The Colrows SDK page lists every setting.

  7. Start a run and read the answer

    POST /api/quorum/v1/agents/<agentId>/runs
    { "input": { "question": "Which region had the highest revenue last week?" } }
    
    GET /api/quorum/v1/runs/<runId>/result

    The first response carries payload.runId. An idle worker can take up to 30 seconds to claim the run. The result carries the answer, its findings, the evidence for each finding, and the outcome of the answer check.

What you have just done

Step in the runWhat enforced it
The worker received a token that works for this run only.The run token, with only the scopes of the tools in the spec.
The agent could call only the tools in the spec, on the datasource in scope.The guard on the server, on every tool call.
The query ran with the access of the user who started the run.The identity mode of the spec, and your data access and masking policies.
Every finding cited an execution from this run.The self-check in the worker, then the answer check on the server.
The run, its tool calls, and its events were recorded.The audit trail. Read them with GET /runs/<runId>/tool-calls and /events.

Where to go next

  • Put it on a schedule. Add a SCHEDULE trigger to the spec. See Agent spec.
  • Try another pattern. MONITOR checks metrics against thresholds, INVESTIGATOR explains why a metric changed, and DOCUMENT_ANALYST answers from documents. See Patterns.
  • Let the agent act. Register an action, list it in the spec, and add a handler to your worker, so the agent can tell a team or open a ticket. See actions and approvals.
  • Call your own code. Declare a customer tool in the spec and register the function in your worker. See customer tools.
  • Write your own agent code. Keep the governed tools and the evidence check, and bring your own loop or framework. See Full code.
  • Measure accuracy. Add an evaluation suite, turn requireEvaluation on, and name reviewers. See Accuracy and review.
  • Understand the platform. Agents at work explains how the control plane, your compute, and the semantic layer fit together.