assistant

module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2026 License: AGPL-3.0

README

Patch — Assistant Service

Patch is the Datum Cloud assistant: ask it about your project in plain language — "why is my pipeline lagging?" — and it answers using the real state of your services, running their own diagnostic tools and explaining what it finds.

Patch is itself a service in the Milo service catalog (assistant.miloapis.com), and it works the way everything on the platform works:

  1. Providers register services in the catalog. A service that wants to be part of Patch publishes its agent capabilities alongside its catalog registration: what the service is, what an assistant should know about it, which of its tools the assistant may call (a reviewed allow-list — never the whole API), and which skills — reviewed, step-by-step procedures — it may follow.
  2. Entitlements decide who gets what. When a customer's project is entitled to a service, that service's capabilities appear in the project's Patch — automatically. No entitlement, no capability; revoke it and the next conversation turn no longer has it.
  3. Every conversation is composed per project. Patch assembles the knowledge and tools of exactly the services your project is entitled to, remembers your conversation (durably, scoped to the project), and does the work.
  4. Usage is metered like any other catalog service. Every model call and every provider tool invocation lands on the platform's billing pipeline, attributed to the project and conversation — the same metrics-to-billing path the rest of the catalog uses.

Who gets what out of it:

Audience What Patch gives them
Customers / developers An operator that can do things with their services — diagnose, inspect, explain — across every service their project is entitled to.
Service providers A distribution channel: publish knowledge + tools once through the catalog, reach every entitled customer's assistant.
The platform Usage-based bill-back, model-vendor independence, and one enforced boundary for what agents may touch.

This repository is Patch's runtime: a standalone Go backend that any consumer talks to over open standards — the Cloud Portal, the bundled patch CLI, or any other agent. A2A (Agent2Agent) is the protocol consumers use to chat with Patch; MCP (Model Context Protocol) is how Patch calls provider tools; capability documents are the small JSON contract through which the catalog (or anything else) tells Patch what a project is entitled to. Nothing here is a proprietary Datum API, and the assistant runs standalone — the catalog is one producer of its configuration, not a dependency.

Try it

The full environment — the assistant behind the AI gateway, a demo provider, and a durable store — runs on a local kind cluster:

cp .env.example .env
task dev:setup            # kind cluster + operators + the stack
task dev:forward          # assistant → localhost:1986

PATCH_URL=http://localhost:1986 \
  PATCH_TOKEN=$(kubectl -n patch-playground create token patch-dev --duration=1h) \
  go run ./cmd/patch chat -i --project demo-project

Then ask it to "Diagnose pipeline p-1 for StreamCo" and watch it call the provider's tool and explain the result. Full walkthrough (and a no-cluster local run) in docs/development.md.

Conversations are durable. Browse and resume past threads — this reads the aggregated apiserver (assistant.miloapis.com) with your k8s identity, so it uses KUBECONFIG, not PATCH_TOKEN:

task dev:chats                       # list this project's conversations
task dev:chats ID=<context-id>       # show one transcript
task dev:chat CTX=<context-id>       # resume it

# or directly:
go run ./cmd/patch conversations list --project demo-project
go run ./cmd/patch conversations show <context-id> --project demo-project

Documentation

Start with the architecture overview; it indexes every surface below.

Architecture

Components

Reference and guides

Design records for shipped work live in docs/enhancements.

Status

Implemented and running: the A2A v1.0 runtime, per-project capability composition (knowledge + tools + skills), durable conversation memory and task store on PostgreSQL, gateway-metered billing, control-plane TokenReview + fail-closed SubjectAccessReview authorization, and a production deployment overlay.

On the roadmap:

  • Portal A2A v1.0 client — bring the Cloud Portal onto the v1.0 wire so it consumes this service like any other A2A client.
  • Conversation API surface — a consumer-facing API (Conversation as a KRM resource) on top of the storage layer, to list and reopen conversations under platform authz.
  • Skills through the catalog — project provider-published skills via the catalog's AgentBinding, not just the fixture path.
  • Untrusted-provider SSRF posture — config-wire the capability host allow-list for third-party providers (the guard already supports it).
  • Signed agent cards — enterprise trust.

Directories

Path Synopsis
Package agentcore is a small, provider-neutral toolkit for driving a streaming language model through a tool-use loop.
Package agentcore is a small, provider-neutral toolkit for driving a streaming language model through a tool-use loop.
anthropic
Package anthropic adapts the official anthropics/anthropic-sdk-go into an agentcore.Model.
Package anthropic adapts the official anthropics/anthropic-sdk-go into an agentcore.Model.
mcptool
Package mcptool adapts a Model Context Protocol (MCP) server into agentcore.Tool values, using the official modelcontextprotocol/go-sdk client over the Streamable HTTP transport.
Package mcptool adapts a Model Context Protocol (MCP) server into agentcore.Tool values, using the official modelcontextprotocol/go-sdk client over the Streamable HTTP transport.
mockmodel
Package mockmodel provides a scriptable, in-process agentcore.Model that needs no API key and no network.
Package mockmodel provides a scriptable, in-process agentcore.Model that needs no API key and no network.
openaicompat
Package openaicompat adapts the official openai/openai-go v3 client, speaking the Chat Completions API, into an agentcore.Model.
Package openaicompat adapts the official openai/openai-go v3 client, speaking the Chat Completions API, into an agentcore.Model.
cmd
assistant command
Command assistant is the A2A runtime for the Datum AI Agent Framework — the Go port of the TypeScript assistant service.
Command assistant is the A2A runtime for the Datum AI Agent Framework — the Go port of the TypeScript assistant service.
assistant-apiserver command
Command assistant-apiserver is the milo aggregated API server that exposes resources under the assistant.miloapis.com API group, including durable chat conversations as a KRM resource (assistant.miloapis.com/v1alpha1 Conversations, with a messages subresource) and CapabilityGapReports.
Command assistant-apiserver is the milo aggregated API server that exposes resources under the assistant.miloapis.com API group, including durable chat conversations as a KRM resource (assistant.miloapis.com/v1alpha1 Conversations, with a messages subresource) and CapabilityGapReports.
milo-assistant command
The cobra command tree for `datumctl assistant`, and the three seams where it differs from the standalone CLI: the project comes from datumctl's injected environment, the token from datumctl's credentials helper, and the service URL from --url/PATCH_URL.
The cobra command tree for `datumctl assistant`, and the three seams where it differs from the standalone CLI: the project comes from datumctl's injected environment, the token from datumctl's credentials helper, and the service URL from --url/PATCH_URL.
patch command
Command patch is the standalone Datum Cloud assistant (A2A) CLI: a thin client over the assistant service, driven by PATCH_URL/PATCH_TOKEN.
Command patch is the standalone Datum Cloud assistant (A2A) CLI: a thin client over the assistant service, driven by PATCH_URL/PATCH_TOKEN.
internal
a2a
Tool-activity events: the structured "what is the assistant doing right now" signal clients render while a turn is in flight.
Tool-activity events: the structured "what is the assistant doing right now" signal clients render while a turn is in flight.
agent
Package agent orchestrates one conversational task: it loads the project's capability documents, composes them into knowledge and provider tools, drives the agentcore tool-use loop against the resolved model, and meters the run's usage.
Package agent orchestrates one conversational task: it loads the project's capability documents, composes them into knowledge and provider tools, drives the agentcore tool-use loop against the resolved model, and meters the run's usage.
agentwiring
Package agentwiring builds the agent-execution stack — model, capability source, conversation/memory/gap-report stores, usage emitter — and adapts it to assistanta2a.AgentRunner.
Package agentwiring builds the agent-execution stack — model, capability source, conversation/memory/gap-report stores, usage emitter — and adapts it to assistanta2a.AgentRunner.
apiserver
Package apiserver assembles the conversations aggregated API server: the runtime scheme/codecs for the assistant group and the generic apiserver wiring that installs the bespoke Conversation REST (a read view over the shared history store) — no etcd, no generic registry.
Package apiserver assembles the conversations aggregated API server: the runtime scheme/codecs for the assistant group and the generic apiserver wiring that installs the bespoke Conversation REST (a read view over the shared history store) — no etcd, no generic registry.
apiserver/registry/capabilitygapreport
Package capabilitygapreport is the bespoke read-only REST storage backing the conversations aggregated apiserver's capabilitygapreports resource.
Package capabilitygapreport is the bespoke read-only REST storage backing the conversations aggregated apiserver's capabilitygapreports resource.
apiserver/registry/conversation
Package conversation is the bespoke read-only REST storage backing the conversations aggregated apiserver.
Package conversation is the bespoke read-only REST storage backing the conversations aggregated apiserver.
apiserver/registry/endpoint
Package endpoint is the read-only REST storage backing the aggregated apiserver's assistantendpoints resource: it tells a client where to send A2A traffic.
Package endpoint is the read-only REST storage backing the aggregated apiserver's assistantendpoints resource: it tells a client where to send A2A traffic.
auth
Package auth splits request handling into two deliberately separate seams:
Package auth splits request handling into two deliberately separate seams:
basetools
Package basetools is the set of tools every project's Patch has, whoever the providers are.
Package basetools is the set of tools every project's Patch has, whoever the providers are.
capability
Package capability owns the assistant's capability-document schema and the composition that turns a project's documents into the model's system-prompt knowledge and provider tools.
Package capability owns the assistant's capability-document schema and the composition that turns a project's documents into the model's system-prompt knowledge and provider tools.
config
Package config is the single place that reads the environment.
Package config is the single place that reads the environment.
gapreport
Package gapreport stores capability-gap reports: durable records the assistant writes when a provider service let a user down — either no tool existed for what they needed, or a tool ran and handed back something thin, misleading, or unactionable — so the provider's own team, not the consumer project the conversation happened in, can act on it.
Package gapreport stores capability-gap reports: durable records the assistant writes when a provider service let a user down — either no tool existed for what they needed, or a tool ran and handed back something thin, misleading, or unactionable — so the provider's own team, not the consumer project the conversation happened in, can act on it.
history
Package history stores conversation turns so a follow-up message in the same A2A context is answered with the prior exchange in the prompt.
Package history stores conversation turns so a follow-up message in the same A2A context is answered with the prior exchange in the prompt.
logger
Package logger provides the service's structured logger: a thin wrapper over log/slog so every package logs the same way and tests can silence output.
Package logger provides the service's structured logger: a thin wrapper over log/slog so every package logs the same way and tests can silence output.
memory
Package memory stores durable project-scoped facts the assistant learns while working with a project — goals, conventions, decisions, standing constraints — so they persist across conversations and are visible to every user working on the same project.
Package memory stores durable project-scoped facts the assistant learns while working with a project — goals, conventions, decisions, standing constraints — so they persist across conversations and are visible to every user working on the same project.
metrics
Package metrics defines the assistant's application-level Prometheus collectors — conversation turns, tool calls, model calls, history compaction, and capability-gap reports — and the Metrics handle used to record them.
Package metrics defines the assistant's application-level Prometheus collectors — conversation turns, tool calls, model calls, history compaction, and capability-gap reports — and the Metrics handle used to record them.
patchcli
Package patchcli is the Datum Cloud assistant (A2A) client shared by the two binaries that ship it: `patch` (cmd/patch, the standalone CLI the e2e harness drives) and `datumctl assistant` (cmd/milo-assistant, the datumctl plugin).
Package patchcli is the Datum Cloud assistant (A2A) client shared by the two binaries that ship it: `patch` (cmd/patch, the standalone CLI the e2e harness drives) and `datumctl assistant` (cmd/milo-assistant, the datumctl plugin).
plantoken
Package plantoken proves that what is about to be applied is exactly what somebody was already shown.
Package plantoken proves that what is about to be applied is exactly what somebody was already shown.
projectapi
Package projectapi is how Patch reads and writes one project's resources — always as the person who asked, never as itself.
Package projectapi is how Patch reads and writes one project's resources — always as the person who asked, never as itself.
server
Package server wires the assistant's HTTP surface: liveness at GET /healthz, readiness at GET /readyz, Prometheus telemetry at GET /metrics, the public agent card at /.well-known/agent-card.json (+ the legacy /.well-known/agent.json alias), and the POST /a2a JSON-RPC endpoint.
Package server wires the assistant's HTTP surface: liveness at GET /healthz, readiness at GET /readyz, Prometheus telemetry at GET /metrics, the public agent card at /.well-known/agent-card.json (+ the legacy /.well-known/agent.json alias), and the POST /a2a JSON-RPC endpoint.
taskstore
Package taskstore provides a durable, tenant-aware taskstore.Store implementation for the A2A task lifecycle.
Package taskstore provides a durable, tenant-aware taskstore.Store implementation for the A2A task lifecycle.
tenant
Package tenant resolves the milo project that scopes a conversations apiserver request.
Package tenant resolves the milo project that scopes a conversations apiserver request.
tracing
Package tracing wires the OpenTelemetry Go SDK for the assistant's binaries.
Package tracing wires the OpenTelemetry Go SDK for the assistant's binaries.
usage
Package usage builds and emits the assistant's billing usage as CloudEvents.
Package usage builds and emits the assistant's billing usage as CloudEvents.
pkg
apis/assistant
Package assistant contains the internal types for the assistant API group.
Package assistant contains the internal types for the assistant API group.
apis/assistant/install
Package install registers the assistant API group with a runtime scheme.
Package install registers the assistant API group with a runtime scheme.
apis/assistant/v1alpha1
Package v1alpha1 contains API Schema definitions for the assistant v1alpha1 API group.
Package v1alpha1 contains API Schema definitions for the assistant v1alpha1 API group.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL