M4 implementada e backlog validado

This commit is contained in:
Marcos Lohmann
2026-09-14 11:22:03 -03:00
parent c894c1604b
commit 2fe6d6d508
53 changed files with 3152 additions and 39 deletions

View File

@@ -0,0 +1,42 @@
"""Finance backend for the Modo A multiagent demo (EP-13-T05, ADR-024).
Same shape as `backends.sales_agent` -- a thin factory around `ExampleAgent`
bound to the `finance-payments-agent` MCP Client identity (EP-01) instead.
See `sales_agent/__init__.py`'s module docstring for why the two backends
share everything except identity/prompt.
"""
from __future__ import annotations
from openai import AsyncOpenAI
from emcp_bus.audit.sink import AuditSink
from example_agent.agent import ExampleAgent
SYSTEM_PROMPT = (
"You are a helpful assistant for a finance/billing team. Use only the "
"tools you are given -- never claim to have capabilities outside them, "
"and never invent a tool name that wasn't offered to you. Executing a "
"payment above the approval threshold always requires a human approval "
"before it can complete -- never tell the customer it is done until the "
"tool result confirms it."
)
def build_finance_agent(
*,
gateway_url: str,
bearer_token: str,
llm_client: AsyncOpenAI,
model: str,
audit_sink: AuditSink | None = None,
) -> ExampleAgent:
return ExampleAgent(
gateway_url=gateway_url,
bearer_token=bearer_token,
llm_client=llm_client,
model=model,
agent_name="finance_agent",
system_prompt=SYSTEM_PROMPT,
audit_sink=audit_sink,
)

View File

@@ -0,0 +1,43 @@
"""Sales backend for the Modo A multiagent demo (EP-13-T05, ADR-024).
A thin factory around the same `ExampleAgent` (EP-13-T01) every other
example-agent test already uses -- bound to a Sales MCP Client identity
(`sales-read-agent`/`sales-write-agent`, EP-01). Nothing about `ExampleAgent`
itself is Sales-specific; only the bearer token and system prompt differ
from `finance_agent`, which is the point (ADR-023: the security boundary is
identity/credential, never code path or prompt text).
"""
from __future__ import annotations
from openai import AsyncOpenAI
from emcp_bus.audit.sink import AuditSink
from example_agent.agent import ExampleAgent
SYSTEM_PROMPT = (
"You are a helpful assistant for a sales team. Use only the tools you are "
"given -- never claim to have capabilities outside them, and never invent "
"a tool name that wasn't offered to you. If the customer wants to pay an "
"invoice or discuss a payment, tell them you will connect them with "
"billing -- you cannot process payments yourself."
)
def build_sales_agent(
*,
gateway_url: str,
bearer_token: str,
llm_client: AsyncOpenAI,
model: str,
audit_sink: AuditSink | None = None,
) -> ExampleAgent:
return ExampleAgent(
gateway_url=gateway_url,
bearer_token=bearer_token,
llm_client=llm_client,
model=model,
agent_name="sales_agent",
system_prompt=SYSTEM_PROMPT,
audit_sink=audit_sink,
)