Repository navigation
Component Agent Runtime
The agent runtime is a Node HTTP server around the Strands SDK. It creates a Max Height agent with a Bedrock model and three tools, exposes /ping and /invocations, tracks short-lived sessions in memory, and includes separate modules for memory extraction/storage, personality checking, stutter injection, re-engagement, observability spans, and golden personality evaluation data. It connects conceptually to Component-WebSocket-Transport and deployment resources in Component-Infra-Stacks.
-
packages/agent/src/index.tscreates the Strands agent and HTTP server. -
packages/agent/src/handlers/sessionManager.tscreates sessions and enforces caps. -
packages/agent/src/handlers/reEngagement.tsschedules idle nudges. -
packages/agent/src/handlers/personalityCheck.tschecks response text for voice and banned patterns. -
packages/agent/src/handlers/observability.tsemits trace spans as JSON. -
packages/agent/src/memory/*defines memory extraction, adapter, handlers, and a client abstraction. -
packages/agent/src/personality/systemPrompt.tsbuilds the system prompt. -
packages/agent/src/personality/stutterInjection.tsdetects/injects stutters. -
packages/agent/src/tools/*defines weather, news, and web-search tool schemas and fetchers. -
packages/agent/src/evaluations/personality-gate.tsexports the golden-set evaluation configuration. -
packages/agent/src/types/index.tsexports shared agent-side interfaces.
Runtime:
createMaxHeightAgent(options?: { displayAlias?: string })__test = { sessions, requestHandler, handleInvocations }
Session handling:
type SessionState = 'GREETING' | 'ACTIVE' | 'IDLE' | 'WINDING_DOWN' | 'ENDED'type EndReason = 'cap_reached' | 'user_left' | 'error' | 'manual'createSession(params: { actorId: string; greetingId: string }): SessioncheckSessionCaps(session: Session): SessionCapResultendSession(session: Session, reason: EndReason): SessiongetSessionState(session: Session): SessionState
Personality and stutter:
buildSystemPrompt(options?: SystemPromptOptions): stringcheckPersonality(input: PersonalityCheckInput): PersonalityCheckResultisStutter(text: string): booleancountStutters(text: string): numberinjectStutters(text: string, options: StutterOptions): StutterResult
Memory:
createMemoryAdapter(config: MemoryAdapterConfig): MemoryAdapterextractMemories(turns: TurnContent[], sessionId: string): ExtractionResultcreateAgentCoreMemoryClient(): AgentCoreMemoryClient-
handleForgetMe(adapter, actorId),handleListMemories(adapter, actorId),handleDeleteMemory(adapter, memoryRecordId)
Tools:
-
newsToolSchema,fetchNews(input, fetchFn?) -
weatherToolSchema,fetchWeather(input, fetchFn?) -
webSearchToolSchema,fetchWebSearch(input, fetchFn?)
Observability and evaluation:
TRACE_SPANS-
startSpan(name, attributes?),endSpan(name, additionalAttributes?),getActiveSpans(),setSpanEmitter(fn) -
RUBRIC_DIMENSIONS,PASS_CRITERIA,AUTO_FAIL_RULES,TEST_CATEGORY_REQUIREMENTS,goldenTestCases
index.ts starts an HTTP listener on port 8080 unless running under tests. GET /ping returns a health JSON response. POST /invocations parses JSON containing optional message, displayAlias, sessionId, actorId, and greetingId.
For each invocation it:
- Starts a
session.cold_startspan. - Gets or creates an in-memory
Session. - Enforces 50 turns, 20,000 estimated/reported tokens, and 30 minutes.
- Creates a Strands agent with the current display alias.
- Invokes the model with the message or
Hello. - Extracts text blocks from the result.
- Updates turn/token counts.
- Streams Server-Sent Events shaped as
data: { type: 'text' | 'done' | 'error', ... }.
The agent factory uses a Bedrock model ID and maxTokens: 250, plus tools named get_news, get_weather, and web_search.
Memory extraction is pattern-based. It can extract:
- display alias from assistant name questions followed by user answers.
- user facts.
- preferences.
- repeated or multi-turn topics.
- summaries after at least five user turns.
createMemoryAdapter() namespaces records as /max-height/{actorId}/, retrieves top 10 records, stores records with batch create, lists records, deletes one record, and wipes all records for an actor. Retrieval failures degrade to an empty list.
-
warmBedrockClient()only constructs the agent — it never exercises the Bedrock client. The V2 snapshot therefore captures none of the endpoint resolution, service-model parsing or connection-pool setup that the warm-up exists to capture, and every restored instance re-pays it. The stated benefit of the readiness gate is currently unrealized. Tracked as T154; it is a Concept-Budget-Ceiling decision because a real round-trip costs tokens on every container start. -
createAgentCoreMemoryClient()intentionally throws:AgentCore Memory client not configured.... Production memory requires a real client or dependency injection; tests can mock it. - Memory modules are exported, but
index.tsdoes not retrieve memories, store extracted memories, or pass memory context intobuildSystemPrompt(). -
checkPersonality()andinjectStutters()exist but are not invoked inindex.ts; current runtime relies on the system prompt and tools rather than a post-generation gate. - The agent server streams SSE over HTTP, while the frontend transport currently expects WebSocket message frames.
- Concept-Cloud-Only-Inference
- Concept-Budget-Ceiling
- Concept-Personality-Gate
- Concept-IP-And-Legal-Posture
- Concept-Supply-Chain-Discipline
- Concept-Graceful-Degradation
- Concept-Observability
- Concept-Testing-And-TDD
- Concept-Credential-Hygiene
Editing in the browser? Wiki edits are live and bypass wiki:lint. Read
Guide-Wiki-Contributing first.