Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

KYCortex

Open-source agent orchestration runtime and developer framework for regulated workflows

KYCortex is an open-source agent orchestration runtime and control plane for regulated workflows. It coordinates specialized agents, provider and model routing, validation, repair cycles, and persisted workflow state so teams can build and run auditable AI-assisted delivery flows.

The package still exposes a framework and SDK layer for developers who want to compose custom agents, providers, and workflows on top of the runtime. In practice, KYCortex should be read as a runtime/platform with framework ergonomics rather than as a prompt-only helper library.

Features

  • Orchestration core: Coordinates agents, manages workflow state, and exposes the public control surface for task and workflow execution.
  • Provider and model routing: Supports OpenAI, Anthropic, and Ollama through a shared provider interface with model-readiness checks, primary-provider model candidates, and fallback-provider routing.
  • Workflow resilience: Supports task dependencies, topological ordering, configurable failure policies, and resumable execution, plus bounded repair cycles after interruptions or failed runs.
  • Validation and repair runtime: Detects likely truncated code or test outputs, enforces task-level size and shape constraints, and feeds structured repair evidence into follow-up attempts.
  • Deterministic validation context: Derives API, test, and dependency-manifest checks from generated artifacts so downstream agents can review against concrete runtime signals instead of prompt text alone.
  • Specialized agents:
    • Architect: Designs software architecture and module structure.
    • Code Engineer: Writes production-quality Python code.
    • Dependency Manager: Produces runtime dependency manifests such as requirements.txt for generated projects.
    • Code Reviewer: Reviews code for quality, security, and best practices.
    • QA Tester: Generates pytest test suites.
    • Docs Writer: Creates README files, API docs, and tutorials.
    • Legal Advisor: Handles licensing, compliance, and NOTICE files.
  • Persistent project memory: JSON and SQLite state management tracks tasks, decisions, artifacts, execution history, and provider-call metadata.
  • Extensible framework layer: Exposes public configuration, agent, provider, workflow, and persistence seams for custom runtime integrations.

Product Layers

KYCortex currently spans three complementary layers:

  1. Runtime / control plane: executes agent workflows, enforces policies, persists state, and captures operator-facing telemetry.
  2. Developer framework / SDK: provides the public Python interfaces for configuring agents, providers, workflows, and persistence backends.
  3. Reference workflow layer: includes repository workflows such as provider-matrix validation and release-user-smoke that demonstrate how the runtime behaves on regulated-style delivery tasks, plus a packaged compliance workflow pack (kycortex_agents.workflows.compliance) with ready-to-run KYC intake, AML sanctions screening, vendor due diligence, and audit risk-scoring scenarios.

Installation

# Install the published package from PyPI
pip install kycortex-agents

For local development:

# Clone repository
git clone https://github.com/alexandrade1978/kycortex-agents.git
cd kycortex-agents

# Install the package
pip install .

# Or install the editable test environment for local development
pip install -e ".[test]"

Quick Start

from kycortex_agents import KYCortexConfig, Orchestrator, ProjectState, Task

# Configure
config = KYCortexConfig(llm_model="gpt-4o-mini", api_key="your-key")

# Define project
project = ProjectState(
    project_name="MyApp",
    goal="Build a FastAPI app with user authentication"
)

# Add tasks
project.add_task(Task(
    id="arch", title="Architecture",
    description="Design system architecture",
    assigned_to="architect"
))

# Run
orch = Orchestrator(config)
orch.execute_workflow(project)

See examples/ for complete examples, including example_provider_matrix_validation.py for resume-enabled empirical provider validation across the supported runtimes.

The provider-matrix validation example now supports configurable empirical envelopes for timeout and task-budget prompts (--request-timeout-seconds, --ollama-timeout-seconds, --code-line-budget, --test-line-budget, and --test-max-top-level-tests) so local or stronger-model runs can be tuned without changing workflow contracts.

For a real user-style local creation smoke against a live provider, run examples/example_release_user_smoke.py. It exercises the public package API, generates a small project, and validates the generated Python artifact with a sample call before reporting success. Use --scenario baseline|tight_margin|many_expenses to keep daily canary checks temporally meaningful instead of replaying a single fixed input profile.

Provider preflight validation now distinguishes backend reachability from model readiness. In practice, this means cloud providers must expose the configured model through their model-listing API before generation starts, and Ollama must expose both a reachable /api/tags endpoint and the configured local model.

Configuration

Choose a provider and either pass credentials directly or rely on the provider-specific environment variable:

  • OpenAI: OPENAI_API_KEY
  • Anthropic: ANTHROPIC_API_KEY
  • Ollama: no API key required; defaults to http://localhost:11434

The built-in runtime now performs a provider health probe before generation. A provider can be reachable but still fail fast if the configured model is not ready for that backend.

OpenAI example:

config = KYCortexConfig(
    llm_provider="openai",
    llm_model="gpt-4o-mini",
    temperature=0.2,
    project_name="my-project",
    output_dir="./output"
)

Anthropic example:

config = KYCortexConfig(
    llm_provider="anthropic",
    llm_model="claude-haiku-4-5-20251001",
    temperature=0.2,
    project_name="my-project",
    output_dir="./output"
)

Ollama example:

config = KYCortexConfig(
    llm_provider="ollama",
    llm_model="qwen2.5-coder:7b",
    base_url="http://localhost:11434",
    ollama_num_ctx=16384,
    project_name="my-project",
    output_dir="./output"
)

For local Ollama runs, the repository's validated baseline is qwen2.5-coder:7b with ollama_num_ctx=16384. The framework talks to Ollama over HTTP, so local use only requires a running Ollama server plus that model installed on the machine that serves the endpoint. If your Ollama server is not exposed at the default http://localhost:11434, set base_url to the correct host and port.

Workflow control example:

config = KYCortexConfig(
    llm_provider="openai",
    llm_model="gpt-4o-mini",
    workflow_failure_policy="continue",
    workflow_resume_policy="resume_failed",
    workflow_max_repair_cycles=1,
    project_name="my-project",
    output_dir="./output"
)
  • workflow_failure_policy="fail_fast": stop the workflow on the first terminal task failure.
  • workflow_failure_policy="continue": allow independent work to continue while dependency-blocked descendants are skipped.
  • workflow_resume_policy="interrupted_only": resume only tasks that were in flight when execution stopped.
  • workflow_resume_policy="resume_failed": re-queue failed tasks and dependency-skipped descendants for another run.
  • workflow_max_repair_cycles=1: bound corrective reruns when resume_failed is active.

Tasks can also declare dependencies=[...] to build a dependency-aware workflow graph, as shown in examples/example_simple_project.py.

Configuration Parameters

KYCortexConfig exposes the following public runtime parameters:

Parameter Default Description
llm_provider "openai" Selects the built-in provider backend. Supported values are openai, anthropic, and ollama.
llm_model "gpt-4o" Provider-specific model name used for agent execution.
llm_model_candidates () Optional ordered additional models for the primary provider. The runtime attempts llm_model first, then each candidate.
api_key None Optional explicit API key. When omitted, OpenAI and Anthropic fall back to OPENAI_API_KEY and ANTHROPIC_API_KEY.
base_url None or Ollama default Optional provider base URL. Ollama defaults to http://localhost:11434.
ollama_num_ctx None Optional Ollama-specific context window override passed as num_ctx in generate requests. Useful for local repair-heavy workflows that need more than the runtime default context.
ollama_think None Optional Ollama reasoning/thinking mode override. When unset, reasoning-capable Ollama models default to think=false in runtime requests; set explicitly to force true or false.
temperature 0.2 Sampling temperature validated between 0 and 2.
max_tokens 4096 Maximum number of output tokens requested from the provider. For Ollama, this is forwarded as options.num_predict.
timeout_seconds 60.0 Provider request timeout in seconds.
adaptive_prompt_policy_enabled False Enables model-adaptive prompt policy resolution for built-in agents. When disabled, legacy token-threshold prompt compaction behavior is preserved.
adaptive_prompt_compact_threshold_tokens 1200 Token threshold used by the adaptive prompt policy to force compact mode for tight completion budgets.
adaptive_prompt_default_mode "balanced" Default adaptive prompt mode when heuristics do not force compact or rich. Allowed values: compact, balanced, rich.
adaptive_prompt_mode_overrides {} Optional exact provider:model -> mode overrides for adaptive prompt policy routing.
provider_timeout_seconds {} Optional per-provider timeout overrides keyed by provider name, used for primary and fallback provider runtime configs.
provider_fallback_order () Optional ordered list of fallback providers to use when the primary provider/model path fails or is unavailable.
provider_fallback_models {} Provider-to-model mapping for fallback routing. Each value may be a single model string or an ordered model sequence for multi-model fallback per provider.
workflow_failure_policy "fail_fast" Controls whether workflow execution stops immediately or continues while skipping blocked descendants.
workflow_resume_policy "interrupted_only" Controls whether resume only re-queues interrupted tasks or also re-queues failed and dependency-skipped tasks.
workflow_max_repair_cycles 1 Maximum bounded repair cycles allowed when failed tasks are resumed with corrective context.
provider_health_check_cooldown_seconds 0.0 Reuses a recent unhealthy health snapshot during the cooldown window instead of probing the same failing backend again immediately.
execution_sandbox_max_cpu_seconds 30.0 CPU-time budget for generated test execution inside the sandbox.
execution_sandbox_max_wall_clock_seconds 60.0 Wall-clock timeout for generated test execution, independent from the CPU-time budget.
execution_sandbox_max_memory_mb 512 Memory ceiling for generated test execution inside the sandbox.
project_name "kycortex-project" Human-readable project name persisted into workflow state and snapshots.
output_dir "./output" Output root used for persisted artifacts and validation files. The directory is created lazily when the runtime first writes to it.
log_level "INFO" Public log-level setting reserved for orchestrator and runtime logging configuration.

Runtime Hardening Notes

  • Built-in providers now expose model-readiness health snapshots that distinguish backend_reachable from model_ready.
  • Built-in architect and code-engineer prompt compaction can now run in adaptive policy modes (compact, balanced, rich) instead of assuming low-budget compression for every model.
  • Provider metadata now preserves requested token budgets plus backend-specific stop reasons such as OpenAI finish_reason, Anthropic stop_reason, and Ollama done_reason when available.
  • Generated code and tests are validated against task-level budgets derived from task text, including optional line limits, CLI entrypoint requirements, test-count limits, fixture budgets, and completion diagnostics for likely truncated outputs.
  • Artifact persistence rejects relative-path escapes, including writes that would leave output_dir through symlinked directories.

Architecture

kycortex_agents/
├── agents/         # Specialized agents and registry
│   ├── architect.py
│   ├── code_engineer.py
│   ├── dependency_manager.py
│   ├── code_reviewer.py
│   ├── qa_tester.py
│   ├── docs_writer.py
│   ├── legal_advisor.py
│   └── registry.py
├── memory/         # State management and persistence backends
│   ├── project_state.py
│   └── state_store.py
├── providers/      # Shared provider interface and implementations
│   ├── base.py
│   ├── factory.py
│   ├── openai_provider.py
│   ├── anthropic_provider.py
│   └── ollama_provider.py
├── workflows/      # Public workflow module surface
├── orchestrator.py # Main coordinator
├── config.py       # Global config
├── exceptions.py   # Public exception hierarchy
└── types.py        # Public typed contracts

Runtime Boundary Model

The current architecture treats four views explicitly:

  • internal persisted workflow state as the exact resume source of truth
  • ProjectSnapshot as the public normalized read model
  • AgentView as the prompt-facing filtered projection
  • ProjectState.internal_runtime_telemetry() as the exact operator-facing telemetry read path

Agent prompts consume AgentView, not the raw ProjectSnapshot. Public snapshots no longer expose workflow_telemetry, public task results no longer expose a separate resource_telemetry surface, and exact runtime telemetry is intentionally available only through ProjectState.internal_runtime_telemetry().

See docs/architecture.md, docs/workflows.md, and docs/persistence.md for the detailed boundary rules.

Operational Readiness

Tagged package releases and production go-live are separate decisions in this repository.

  • The current public line is now in Beta pre-release.
  • A workflow is only successful when its declared acceptance criteria pass end to end.
  • Production go-live is now explicitly signed off for the documented single-maintainer deployment class after satisfying the repository-owned SLO, error-budget, and staged go-live gates in docs/go-live-policy.md.
  • Broader deployment claims still require a deployment-class-specific qualification update before the public posture changes.

Use RELEASE.md for package publication and docs/go-live-policy.md for production-readiness policy.

Roadmap

  • Add vector store for long-term memory
  • Web UI for project monitoring
  • Compliance workflow pack for regulated domains (KYC intake, AML sanctions screening, vendor due diligence, audit risk scoring)
  • Additional workflow packs for other regulated domains (MLOps, LLMOps)
  • Integration with CI/CD pipelines

Contributing

Contributions welcome! See CONTRIBUTING.md for workflow guidance and CONTRIBUTOR_RIGHTS.md for contributor-rights expectations under the dual-license model.

Releases

Use RELEASE.md for the repository-owned release validation and tagging procedure. Use RELEASE_STATUS.md for the current repository release-state snapshot. Historical canary operations and evidence are retained separately from the primary public entry surface and are not summarized here.

License

KYCortex Agents is available under a dual-license model.

  • Open-source distribution: GNU Affero General Public License v3.0 - see LICENSE
  • Commercial licensing: available directly from KYCortex for teams that need proprietary deployment or terms outside AGPL - see COMMERCIAL_LICENSE.md

The published package metadata currently reflects the open-source distribution license.

Links


Built by Alexandre Andrade with KYCortex AI.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kycortex_agents-1.0.13b4.tar.gz (834.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kycortex_agents-1.0.13b4-py3-none-any.whl (336.9 kB view details)

Uploaded Python 3

File details

Details for the file kycortex_agents-1.0.13b4.tar.gz.

File metadata

  • Download URL: kycortex_agents-1.0.13b4.tar.gz
  • Upload date:
  • Size: 834.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for kycortex_agents-1.0.13b4.tar.gz
Algorithm Hash digest
SHA256 1ccb3273bf005673b8ec3f4c41356c96bbe34090cd5e421b539bf38eee5e4e07
MD5 07b234833ef295b931419b5e6552c70f
BLAKE2b-256 613bc05bfdd7a35773007b605943329e141ff2f88a6cc69acf2fa42562c27f3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for kycortex_agents-1.0.13b4.tar.gz:

Publisher: release.yml on alexandrade1978/kycortex-agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kycortex_agents-1.0.13b4-py3-none-any.whl.

File metadata

File hashes

Hashes for kycortex_agents-1.0.13b4-py3-none-any.whl
Algorithm Hash digest
SHA256 a5a1085de0f272b8d21e4bda0c9ccba151eba85cad6617da706f500730d555c9
MD5 e358acd196a9f021cdfa1ad88fcd2626
BLAKE2b-256 62cad5e04bbe811ad720a54f7a9570967a7a06412b7ce251c9f20a270c5d76de

See more details on using hashes here.

Provenance

The following attestation bundles were made for kycortex_agents-1.0.13b4-py3-none-any.whl:

Publisher: release.yml on alexandrade1978/kycortex-agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.13b4 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page