Repository layout

Top level

agentcore/       Bedrock AgentCore container runtime (Python)
cdk/             AWS CDK app — one stack, AgentCoreStack (TypeScript)
lambdas/         SAM application — 5 functions, 3 queues, schedules, secret (Python)
libs/            Shared Python libraries, packaged as Lambda layers
bigquery/        BigQuery view definitions (DDL, applied manually)
scripts/         Ad-hoc operator scripts
docs/            This Antora documentation component
.specs/          Historical implementation plans, one per feature
.github/         Security-review workflow and its agent prompt
AGENTS.md        Authoritative conventions for AI coding agents
Makefile         Top-level build and deploy shortcuts

agentcore/ — the runtime

agentcore/
├── main.py                       load_config() → build_registry() → app.run()
├── constants.py                  env-var-driven constants (LOG_GROUP_NAME, MEMORY_ID, …)
├── Dockerfile                    linux/arm64 image, PYTHONPATH=/app
├── config/loader.py              Secrets Manager fetch + Pydantic validation + cache
├── providers/
│   ├── base_service.py           re-export of morpheus_llm BaseAgentService
│   ├── claude_service.py         re-export of morpheus_llm ClaudeAgentService
│   └── agents/dialler_agent.py   pre-wired agent singleton
├── tools/builtin/                local @tool functions
├── types/__init__.py             WorkflowStep, WorkflowResult, InvocationPayload
├── utils/enums.py                re-export of AgentModelIds
├── workflows/
│   ├── __init__.py               build_registry()
│   ├── registry.py               WorkflowRegistry + WorkflowDefinition protocol
│   ├── base_workflow.py          multi-step execution engine
│   └── builtin/                  PromptWorkflow, DiallerAgentWorkflow
└── test/test_main.py

Details: AgentCore runtime.

lambdas/ — the SAM application

Every function follows the same internal shape:

lambdas/<function>/
├── handler.py        lambda_handler — dispatcher only, no business logic
├── registry.py       routing key → (handler class, Pydantic model)
├── events/           one module per event type; handlers extend a Base*Handler
│   └── samples/      example payloads used for `sam local invoke` and tests
├── models/
│   ├── config.py     pydantic-settings Settings — environment variables
│   ├── secrets.py    load_secrets() — @lru_cache over the shared secret
│   └── events.py     event payload models local to this function
├── services/         integrations and orchestration used by handlers
├── utils/            constants, logging setup, pure helpers
├── pyproject.toml    dependencies (uv)
└── requirements.txt  compiled dependency list used by the SAM build

The five functions:

Directory Page

enrichment_scraper/

enrichment-scraper

enrichment_scorer/

enrichment-scorer

morpheus_hubspot/

morpheus-hubspot

email_agent/

email-agent

phone_agent/

phone-agent

lambdas/template.yaml is the single SAM template holding every function, layer, queue, schedule, alarm, and the shared secret. See SAM template.

libs/ — shared libraries

Directory Import prefix Purpose

morpheus-common/

morpheus_common

Event models, SQS publisher, secrets helper, Sentry

morpheus-llm/

morpheus_llm

Strands agent services, Bedrock, MCP tools, model IDs

morpheus-data-layer/

morpheus_data_layer

SQLAlchemy models, repositories, session management

morpheus-bigquery/

morpheus_bigquery

BigQuery client factory

pyb-hubspot/

pyb_hubspot

HubSpot CRM client and every HubSpot API call

Details: Shared libraries.

cdk/

cdk/
├── bin/cdk.ts                      instantiates AgentCoreStack — configuration only
└── lib/
    ├── types.ts                    AgentCoreStackProps
    └── stacks/agentcore-stack.ts   every AWS resource for the runtime

There is exactly one stack. Details: CDK stack.

bigquery/

One .sql file per view, each containing a CREATE OR REPLACE VIEW statement against bigqueryexport-183608. These are applied by hand — there is no migration runner. See BigQuery views.

docs/

This Antora component.

docs/
├── antora.yml                  component descriptor (name: morpheus, version: ~)
└── modules/
    ├── ROOT/                   platform-wide guides
    ├── business/               domain and business rules
    ├── agentcore/              the container runtime
    ├── lambdas/                one page per function
    ├── events/                 event catalog and schemas
    ├── libs/                   shared library reference
    ├── data/                   domain model, ORM, warehouse
    ├── infrastructure/         CDK, SAM, queues, IAM, observability
    └── plans/                  forward-looking design documents