Skip to main content

Symfony Runtime Surfaces

packages/symfony exposes three distinct runtime surfaces. Use this rule of thumb:
  • use the core primitives when you want direct inference, embeddings, or structured output
  • use AgentCtrl when you want Symfony-managed execution of external CLI code agents such as Codex or Claude Code
  • use native agents when you want the in-process Cognesy\Agents runtime with definitions, tools, capabilities, and resumable sessions

1. Core Primitives

This is the lowest-level surface. Use it when your Symfony app needs:
  • direct chat or completion calls
  • embeddings generation
  • structured extraction without agent orchestration
Primary services:
  • Cognesy\Polyglot\Inference\Inference
  • Cognesy\Polyglot\Embeddings\Embeddings
  • Cognesy\Instructor\StructuredOutput
Example:
Choose this surface when you do not need agent-style continuation, registry-driven tools, or external code-agent processes.

2. AgentCtrl

AgentCtrl is the Symfony surface for external code agents. Use it when you want to run tools such as:
  • Codex
  • Claude Code
  • OpenCode
  • Gemini CLI style backends
Primary services:
  • Cognesy\Instructor\Symfony\AgentCtrl\SymfonyAgentCtrl
  • Cognesy\Instructor\Symfony\AgentCtrl\SymfonyAgentCtrlRuntimes
  • Cognesy\Instructor\Symfony\Delivery\Messenger\ExecuteAgentCtrlPromptMessage
Example:
Choose AgentCtrl when the real unit of work is an external coding agent process, not an in-process InstructorPHP runtime.

3. Native Agents

Native agents are the in-process Cognesy\Agents runtime. Use them when you want:
  • package-owned definitions, tools, capabilities, and schemas in Symfony’s container
  • resumable session state
  • direct control over the runtime without shelling out to external agent CLIs
Primary services:
  • Cognesy\Agents\Template\Contracts\CanManageAgentDefinitions
  • Cognesy\Agents\Tool\Contracts\CanManageTools
  • Cognesy\Agents\Capability\CanManageAgentCapabilities
  • Cognesy\Agents\Capability\StructuredOutput\CanManageSchemas
  • Cognesy\Agents\Session\Contracts\CanManageAgentSessions
  • Cognesy\Agents\Template\Contracts\CanInstantiateAgentLoop
  • Cognesy\Instructor\Symfony\Delivery\Messenger\ExecuteNativeAgentPromptMessage
Direct runtime example:
Queued resume example:
Choose native agents when you want long-lived application-owned agent definitions and resumable state inside the Symfony service graph.

Which One Should You Choose?

Choose core primitives when:
  • you want lower-level LLM building blocks
  • orchestration belongs in your own application code
Choose AgentCtrl when:
  • the agent is an external CLI process
  • you want runtime context policy around HTTP, CLI, and Messenger dispatch
Choose native agents when:
  • the agent runtime should stay in PHP
  • you want Symfony-managed definitions, tools, and session persistence
The key distinction is:
  • AgentCtrl orchestrates external agent processes
  • native agents orchestrate the in-process Cognesy\Agents runtime
  • core primitives are not agent orchestration at all