Skip to main content
Pydantic AI is used here inside the PowerContext Server. It supplies schema-bound generation and an independent embedding provider. It does not install the Pydantic AI Agent adapter, add tools to an Agent, or share that adapter’s lifecycle.
Status: available in the built-in runtime at the upstream revision used for this documentation. Install powercontext[builtin] for in-process composition or powercontext[server] for the Server. Python 3.11 or later is required. Calls to real providers, credentials, and production latency were not validated in this verification.

Choose one of four runtime states

Generation and embedding are optional and independent. A model-free Server remains useful: explicit Memory and FTS do not need either provider. Generation does not enable the Scheduler. You may call flush_memory manually, or configure POWERCONTEXT_SERVER_RUNTIME_SCHEDULE_SECONDS separately.

Configure the Server

Install one of the supported roles. This pin is the same commit as the LangGraph and LangChain pages, written as a full hash:
The Server settings use Pydantic AI model strings. Provider-specific environment variables, such as credentials and base URLs, are read by the selected provider. POWERCONTEXT_SERVER_INFERENCE_GENERATION_MODEL_SETTINGS accepts a JSON object shared by generation pipelines, reranking, and the readiness probe. Put provider request fields under extra_body; keep credentials and static headers in provider configuration. Non-empty settings without a generation model, or settings containing extra_headers, fail configuration validation.
EMBEDDING_MODEL, EMBEDDING_PROFILE_ID, and EMBEDDING_DIMENSION are all-or-none. Partial configuration is rejected before startup. The profile is part of the persisted vector contract, so choose its ID, dimension, and normalization deliberately rather than changing them in place.
A model string is configuration, not evidence that a provider works. Readiness sends a small live request, but the documented check does not certify a provider account, credential, quota, regional endpoint, model dimension, or acceptable latency.

Use the structured generator directly

The low-level generator accepts an already constructed and opened Pydantic AI Model; it deliberately rejects a model string. The caller owns that model’s lifecycle.
Server composition is different: InferenceConfig.generation_model accepts a model string, opens the provider model while the runtime is active, reuses it across the generation pipelines, and closes it with the runtime.

Follow the execution flow

Generation flow

Pydantic AI validates the declared output schema. That is only the first check. PowerContext still validates domain rules, evidence references, current versions, and other invariants before generated data can become authoritative state. Generated Experience and Skill content still goes through Candidate Review; structured output is not approval.

Embedding flow

Generation and embedding do not fall back to each other, and there is no cross-provider fallback. One may be healthy while the other is degraded.

Understand search and write failures

A provider outage affects only the paths that depend on that provider. The table separates those paths from durable state that remains authoritative in storage. Provider timeouts and temporary unavailability map to PowerContext inference errors and Server HTTP 503 responses. Invalid output, including reordered embeddings, a wrong vector count or dimension, and non-finite values, is rejected rather than indexed.
Do not interpret a successful FTS fallback as proof that vector search worked. To verify embedding, make an explicit vector request and require a source-linked hit whose matched_by includes vector.

Check readiness without overstating it

Configured generation and embedding each add a non-blocking readiness probe. A failed inference probe reports degraded with HTTP 200, not not_ready. Runtime or database failure is the blocking case and returns not_ready with HTTP 503.
A degraded Server can still perform database-backed operations that do not need the failed provider. An operation that needs that provider may return 503. Readiness checks availability at that moment. It does not validate production quotas, every schema used by the pipelines, sustained concurrency, data quality, or end-to-end latency.

Set privacy and Scope boundaries

The provider receives the serialized input for the operation. Depending on the pipeline, that can include Source content, Memory candidates, a query, Handoff evidence, or Candidate-generation evidence. Provider usage records request and token counts; optional instrumentation may emit inference spans. Configure provider data handling and tracing before sending sensitive project material. Scope still selects PowerContext data. It does not stop selected content from leaving the Server for the configured model, prove user identity, grant model permissions, or approve generated content. Keep secrets out of Source and Memory when the provider must not receive them.

Currently unsupported or not validated

Completion check

Before relying on inference, confirm that:
  • you chose one of the four states intentionally;
  • the three required embedding fields are either all set or all absent;
  • powercontext ready distinguishes ready, degraded, and not_ready correctly;
  • powercontext capabilities lists only the search and generation capabilities you configured;
  • explicit vector verification fails visibly rather than being mistaken for FTS fallback;
  • your provider privacy, tracing, and retention settings fit the data sent by each pipeline;
  • downstream domain validation and Candidate Review remain in place after schema validation.
For a first integration, go back to LangGraph or LangChain. The Pydantic AI Agent adapter is still Preview and currently has no working install command, so read it only when you need it.