core/

directory
v0.0.14-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT

README

Core service

services/core is Core: one Go service that serves the Agents API (/v1), the Core API (/core/v1) and the machine connection routes (/api/v1), owns its PostgreSQL schema, and runs the execution Worker that dispatches Turns to Runtimes. Architecture describes its role, and API namespaces and credentials lists its namespaces and the credential each accepts. This guide is for contributors who build, run and test Core from source; operators install it with the installer. The implementation constraints hold the code-level rules.

Commands

Package Executable Purpose
cmd/server oac-core The HTTP service and execution Worker. It applies the embedded database migrations before serving
cmd/device oac-core-device Provisions or revokes an operator device profile for environment: none engine hosts
cmd/environment-key oac-core-environment-key The break-glass executor credential command
cmd/sandbox-node oac-node The sandbox node program; see the nodes guide
cmd/specification-contract None Regenerates the deployment contract projections of the node installer and the TypeScript client

make build-core builds the four executables into ~/.oac/build/oac-core; Standalone Core builds describes the build and its options. make build-daemon builds oac-daemon.

Database

Core uses its own PostgreSQL database and account and shares no tables with an application. Its schema is the embedded goose migrations in migrations/, tracked in oac_schema_version; AGENTS.md states how schema changes land. Core applies the migrations when it starts. Queries live in internal/db/queries and generate typed code with sqlc: run make sqlc-generate after changing a query and commit the generated files, which make check-sqlc compares.

Run from source

  1. Create a development database. Core applies the migrations when it starts.

  2. Create a Core key of at least 32 characters and a digest file holding its SHA-256, which Core uses to authenticate /core/v1, the credential key that seals stored credentials, and the installation ID. Keep the credential key and the ID with the database:

    umask 077; mkdir -p ~/.oac/dev
    openssl rand -hex 32 > ~/.oac/dev/core.key
    printf '["%s"]\n' "$(tr -d '\n' < ~/.oac/dev/core.key | sha256sum | cut -d' ' -f1)" > ~/.oac/dev/core-key-digests.json
    openssl rand -base64 32 > ~/.oac/dev/credential.key
    uuidgen | tr '[:upper:]' '[:lower:]' > ~/.oac/dev/installation.id
    
  3. Start Core. The Core environment table lists every variable.

    OAC_DATABASE_URL='postgres://oac:…@127.0.0.1:5432/oac_dev' \
    OAC_CORE_KEY_DIGESTS_FILE="$HOME/.oac/dev/core-key-digests.json" \
    OAC_CREDENTIAL_KEY_FILE="$HOME/.oac/dev/credential.key" \
    OAC_INSTALLATION_ID_FILE="$HOME/.oac/dev/installation.id" \
    OAC_PUBLIC_URL=http://127.0.0.1:8091 \
    go run ./services/core/cmd/server
    
  4. Create a Project and an API key with the Core key, as in Script the Core API, and call /v1 with the key as in the quickstart.

  5. To run environment: none Sessions, provision an operator device profile for the Project's tenant and start oac-daemon connect --profile default on a host with a Harness installed. Self-hosted Sessions use the self-hosted guide instead.

Tests

make check-core builds Core and runs the Go tests of services/core and packages/agents-client. Point OAC_TEST_DATABASE_URL at a dedicated database named oac_*_tests that holds no other tables; the tests apply only Core's migrations and use fresh tenants without truncating anything. Without it, database tests skip locally; CI provides its own PostgreSQL. Set OAC_TEST_OFFICIAL_SDK_PYTHON to the interpreter with the pinned SDK for the official-client tests in tests/integration. Validate a change lists the focused checks for other areas.

Official client verification

The official-client suite runs the built server against the pinned OpenAI SDK from upstream.json, with the same test database, temporary keys and fresh tenants, and needs no model provider:

python -m pip install -r services/core/tests/requirements.txt
make build-core
OAC_TEST_DATABASE_URL='postgres://…/oac_local_tests' \
OAC_TEST_SERVER_BIN="${OAC_DEV_HOME:-$HOME/.oac}/build/oac-core/oac-core" \
  python services/core/tests/official_client.py

It checks the upstream and generated response schemas, retries, ordering, tenant isolation, unsupported options and reads after a restart. It also runs the official Go client against two fresh tenants and validates the Sessions it created through the Python SDK.

Generated contracts

Run make openapi after changing the pinned public schema, Go bindings, Core extensions or internal handler annotations. Contract and schema rules owns the inputs, generated files and checks. Review and commit the generated diffs. make check-openapi verifies freshness; contract tests check all three documents against registered routes.

Directories

Path Synopsis
cmd
device command
Command device provisions or revokes an execution device using operator DB access.
Command device provisions or revokes an execution device using operator DB access.
environment-key command
Command environment-key manages executor principal credentials using operator DB authority.
Command environment-key manages executor principal credentials using operator DB authority.
oac command
provider-artifacts command
provider-artifacts generates distribution declarations from registered adapters.
provider-artifacts generates distribution declarations from registered adapters.
sandbox-node command
sandbox-node hosts the selected local Provider and dials its owning Core.
sandbox-node hosts the selected local Provider and dials its owning Core.
server command
Package main runs the standalone Agents API service.
Package main runs the standalone Agents API service.
specification-contract command
specification-contract maintains the generated deployment contract projections of the node installer and the TypeScript client.
specification-contract maintains the generated deployment contract projections of the node installer and the TypeScript client.
internal
adminaudit
Package adminaudit carries non-secret administrator provenance into business transactions, and owns the rules for recording it and the audit log's read models.
Package adminaudit carries non-secret administrator provenance into business transactions, and owns the rules for recording it and the audit log's read models.
agentnetwork
Package agentnetwork validates the public Environment network field.
Package agentnetwork validates the public Environment network field.
agents
Package agents owns saved Agents: reusable configuration a tenant keeps independently of Sessions, with the optional model provider bundle that its x_agents_core.model_provider describes.
Package agents owns saved Agents: reusable configuration a tenant keeps independently of Sessions, with the optional model provider bundle that its x_agents_core.model_provider describes.
api
Code generated by scripts/generate-public-api.py; DO NOT EDIT.
Code generated by scripts/generate-public-api.py; DO NOT EDIT.
automations
Package automations owns Automations: saved schedules that deliver a target Session create or instructions, and the invocation records of each delivery.
Package automations owns Automations: saved schedules that deliver a target Session create or instructions, and the invocation records of each delivery.
coremetrics
Package coremetrics collects bounded operational measurements for administrators.
Package coremetrics collects bounded operational measurements for administrators.
credentialcrypto
Package credentialcrypto encrypts execution-service credentials at rest.
Package credentialcrypto encrypts execution-service credentials at rest.
databaseurl
Package databaseurl reads Core's PostgreSQL connection settings, shared by the server and its maintenance commands.
Package databaseurl reads Core's PostgreSQL connection settings, shared by the server and its maintenance commands.
deployment
Package deployment owns the managed sandbox deployment: the provider, specification and configuration an administrator selects, its generations, and the sandbox nodes that enroll with it, authenticate, report their readiness and serve its generations.
Package deployment owns the managed sandbox deployment: the provider, specification and configuration an administrator selects, its generations, and the sandbox nodes that enroll with it, authenticate, report their readiness and serve its generations.
deployment/placement
Package placement decides whether the sandbox deployment admits new hosted work and which node receives it.
Package placement decides whether the sandbox deployment admits new hosted work and which node receives it.
echotext
Package echotext decides whether an error message may repeat a caller-supplied value.
Package echotext decides whether an error message may repeat a caller-supplied value.
environmentconfig
Package environmentconfig owns the Environment configuration vocabulary: setup (env, setup commands, packages and capability directories), Skills, Plugins and initial files, with their validation and public metadata projections.
Package environmentconfig owns the Environment configuration vocabulary: setup (env, setup commands, packages and capability directories), Skills, Plugins and initial files, with their validation and public metadata projections.
environmenttemplates
Package environmenttemplates owns Environment Templates: saved, tenant-owned hosted Environment configuration that Sessions reference at creation.
Package environmenttemplates owns Environment Templates: saved, tenant-owned hosted Environment configuration that Sessions reference at creation.
execution
Package execution delivers durable Turns through the existing daemon protocol.
Package execution delivers durable Turns through the existing daemon protocol.
files
Package files owns source Files: Project-owned uploaded bytes with immutable metadata, independent of Sessions and of the workspace copies made from them.
Package files owns source Files: Project-owned uploaded bytes with immutable metadata, independent of Sessions and of the workspace copies made from them.
identity
Package identity defines execution-service principals independently of product users.
Package identity defines execution-service principals independently of product users.
items
Package items owns public Items: it projects execution observations to the supported Item variants, merges them into stored Items and builds the ordered public events that report each Item change.
Package items owns public Items: it projects execution observations to the supported Item variants, merges them into stored Items and builds the ordered public events that report each Item change.
jsonobject
Package jsonobject normalizes stored JSON object documents.
Package jsonobject normalizes stored JSON object documents.
metadata
Package metadata owns the rules for resource metadata: string key and value pairs that Agents, Sessions and Vaults carry for their applications.
Package metadata owns the rules for resource metadata: string key and value pairs that Agents, Sessions and Vaults carry for their applications.
modelconfiguration
Package modelconfiguration owns each Harness's deployment default model configuration: its safe view, the encrypted complete bundle that Session creation freezes, the private revision that pairs with it, and the rules for replacing, removing and resolving it.
Package modelconfiguration owns each Harness's deployment default model configuration: its safe view, the encrypted complete bundle that Session creation freezes, the private revision that pairs with it, and the rules for replacing, removing and resolving it.
nativeinstaller
Package nativeinstaller serves qualified native distributions.
Package nativeinstaller serves qualified native distributions.
oauthrefresh
Package oauthrefresh exchanges a stored OAuth refresh grant for an access token.
Package oauthrefresh exchanges a stored OAuth refresh grant for an access token.
persistence/postgres/agentpg
Package agentpg stores saved Agents in PostgreSQL.
Package agentpg stores saved Agents in PostgreSQL.
persistence/postgres/auditpg
Package auditpg stores write and administrator audit records in PostgreSQL.
Package auditpg stores write and administrator audit records in PostgreSQL.
persistence/postgres/automationpg
Package automationpg stores Automations and their invocations in PostgreSQL.
Package automationpg stores Automations and their invocations in PostgreSQL.
persistence/postgres/coremetricspg
Package coremetricspg reads the Core metrics that PostgreSQL holds: the deployment's root Turn queue and its history, and the database size.
Package coremetricspg reads the Core metrics that PostgreSQL holds: the deployment's root Turn queue and its history, and the database size.
persistence/postgres/deploymentpg
Package deploymentpg stores the sandbox deployment, its retained generations and its nodes in PostgreSQL.
Package deploymentpg stores the sandbox deployment, its retained generations and its nodes in PostgreSQL.
persistence/postgres/filepg
Package filepg stores Files in PostgreSQL: metadata in source_files and content in large objects.
Package filepg stores Files in PostgreSQL: metadata in source_files and content in large objects.
persistence/postgres/modelconfigurationpg
Package modelconfigurationpg stores deployment default model configurations in PostgreSQL.
Package modelconfigurationpg stores deployment default model configurations in PostgreSQL.
persistence/postgres/pgtest
Package pgtest opens PostgreSQL databases for Core tests.
Package pgtest opens PostgreSQL databases for Core tests.
persistence/postgres/pgunit
Package pgunit runs Core's PostgreSQL transactions: pooled transactions for public and administrative work, and the execution owner's transactions on the connection that holds the database's execution lease.
Package pgunit runs Core's PostgreSQL transactions: pooled transactions for public and administrative work, and the execution owner's transactions on the connection that holds the database's execution lease.
persistence/postgres/placementpg
Package placementpg loads the placement facts of the sandbox deployment and applies the placements package placement decides, on the caller's transaction-bound queries.
Package placementpg loads the placement facts of the sandbox deployment and applies the placements package placement decides, on the caller's transaction-bound queries.
persistence/postgres/projectpg
Package projectpg stores Projects and their API keys in PostgreSQL.
Package projectpg stores Projects and their API keys in PostgreSQL.
persistence/postgres/runtimehistorypg
Package runtimehistorypg stores and reads bounded periodic Runtime telemetry.
Package runtimehistorypg stores and reads bounded periodic Runtime telemetry.
persistence/postgres/sessionpg
Package sessionpg stores Sessions in PostgreSQL and decides nothing.
Package sessionpg stores Sessions in PostgreSQL and decides nothing.
persistence/postgres/skillpg
Package skillpg stores Skills and their versions in PostgreSQL.
Package skillpg stores Skills and their versions in PostgreSQL.
persistence/postgres/templatepg
Package templatepg stores Environment Templates in PostgreSQL.
Package templatepg stores Environment Templates in PostgreSQL.
persistence/postgres/vaultpg
Package vaultpg stores Vaults and Credentials in PostgreSQL.
Package vaultpg stores Vaults and Credentials in PostgreSQL.
persistence/postgres/workspacepg
Package workspacepg stores independent workspace configurations and durable Environment filesystem ownership.
Package workspacepg stores independent workspace configurations and durable Environment filesystem ownership.
processconfig
Package processconfig is the process settings Core loads from its environment.
Package processconfig is the process settings Core loads from its environment.
projects
Package projects owns Core Projects and their API keys.
Package projects owns Core Projects and their API keys.
providercontract
Package providercontract describes explicit resource-provider operations.
Package providercontract describes explicit resource-provider operations.
publicorigin
Package publicorigin owns OAC_PUBLIC_URL's one rule, shared by Core and the installer.
Package publicorigin owns OAC_PUBLIC_URL's one rule, shared by Core and the installer.
runtime
Package runtime connects execution devices without product dependencies.
Package runtime connects execution devices without product dependencies.
runtimedevice
Package device defines persistence data shared by daemon gateways and their stores.
Package device defines persistence data shared by daemon gateways and their stores.
runtimegateway
Package gateway is the server-side hub of the agent_daemon connector.
Package gateway is the server-side hub of the agent_daemon connector.
runtimeobs
Package runtimeobs resolves durable Session identity to provider-owned Runtime observations.
Package runtimeobs resolves durable Session identity to provider-owned Runtime observations.
runtimeobs/otlpexporter
Package otlpexporter sends sanitized Runtime observation records to an operator-configured OTLP/HTTP metrics endpoint.
Package otlpexporter sends sanitized Runtime observation records to an operator-configured OTLP/HTTP metrics endpoint.
sandbox
Package sandbox defines the Sandbox Provider contract for authorized compute.
Package sandbox defines the Sandbox Provider contract for authorized compute.
sandbox/contracttest
Package contracttest runs shared lifecycle assertions against real adapters backed by controlled native transports.
Package contracttest runs shared lifecycle assertions against real adapters backed by controlled native transports.
sandbox/e2b
Code generated by contractgen; DO NOT EDIT.
Code generated by contractgen; DO NOT EDIT.
sandbox/e2b/internal/contractgen command
Command contractgen projects the adapter's Go declarations into its Python artifacts.
Command contractgen projects the adapter's Go declarations into its Python artifacts.
sandbox/microsandbox
Package microsandbox is the pure-Go client for the colocated SDK helper.
Package microsandbox is the pure-Go client for the colocated SDK helper.
sandbox/node
Package node transports the finite sandbox Provider contract.
Package node transports the finite sandbox Provider contract.
sandbox/opensandbox
Package opensandbox runs Core-managed sandboxes on an operator's OpenSandbox server through its official Go SDK.
Package opensandbox runs Core-managed sandboxes on an operator's OpenSandbox server through its official Go SDK.
sandbox/providers
Node-local adapter configuration and construction.
Node-local adapter configuration and construction.
sessions
Package sessions owns the Session vocabulary: Sessions, Turns and their statuses, inputs, Environments and their provisioning failures, function calls, Item and Artifact reads, executor credentials, and the errors Session operations return.
Package sessions owns the Session vocabulary: Sessions, Turns and their statuses, inputs, Environments and their provisioning failures, function calls, Item and Artifact reads, executor credentials, and the errors Session operations return.
skills
Package skills owns Skills: tenant-owned bundles with immutable, numbered versions and a default version.
Package skills owns Skills: tenant-owned bundles with immutable, numbered versions and a default version.
textvalue
Package textvalue holds the one error shared by every domain for request text that Core cannot store.
Package textvalue holds the one error shared by every domain for request text that Core cannot store.
vaults
Package vaults owns Vaults and their Credentials: the resources, OAuth access-token refresh, and the MCP credential selection that Session creation freezes and execution resolves into a bearer token.
Package vaults owns Vaults and their Credentials: the resources, OAuth access-token refresh, and the MCP credential selection that Session creation freezes and execution resolves into a bearer token.
workspacefs
Package workspacefs defines the independent workspace filesystem boundary.
Package workspacefs defines the independent workspace filesystem boundary.
workspacefs/nfs
Package nfs implements workspace storage on an operator-mounted kernel NFS filesystem.
Package nfs implements workspace storage on an operator-mounted kernel NFS filesystem.
workspacefs/providers
Package providers composes workspace filesystem adapters at process startup.
Package providers composes workspace filesystem adapters at process startup.
workspaces
Package workspaces owns durable Environment filesystem identities.
Package workspaces owns durable Environment filesystem identities.
writeaudit
Package writeaudit carries authenticated, non-secret request provenance to business transactions, and owns the rules for recording it and its read models.
Package writeaudit carries authenticated, non-secret request provenance to business transactions, and owns the rules for recording it and its read models.
Package migrations owns only the OpenAgentCore database schema.
Package migrations owns only the OpenAgentCore database schema.
tests
fixtures command
Command fixtures prepares internal records for official-client recovery tests.
Command fixtures prepares internal records for official-client recovery tests.

Jump to

Keyboard shortcuts

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