diff --git a/.env b/.env index 674c89e..116eb7d 100644 --- a/.env +++ b/.env @@ -22,30 +22,31 @@ LLM_TIMEOUT_SECONDS=120 # OCI OpenAI-compatible endpoint OCI_GENAI_BASE_URL=https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/openai/v1 OCI_GENAI_MODEL=openai.gpt-4.1 -OCI_GENAI_API_KEY=sk-ph3FgX6iP3fxAQCXb9IpPIDTadkeeYAWntUWhzcWysIM6zsS +OCI_GENAI_API_KEY=sk-ph3FgX6ph3FgX6ph3FgX6ph3FgX6ph3FgX6ph3FgX6 OCI_GENAI_PROJECT_OCID= +# OCI_AUTH_MODE=config_file|instance_principal|resource_principal +OCI_AUTH_MODE=config_file # OCI SDK / signer / profiles OCI_CONFIG_FILE=~/.oci/config -OCI_PROFILE=LATINOAMERICA-Chicago -OCI_COMPARTMENT_ID=ocid1.compartment.oc1..aaaaaaaaexpiw4a7dio64mkfv2t273s2hgdl6mgfvvyv7tycalnjlvpvfl3q +OCI_PROFILE=DEFAULT +OCI_COMPARTMENT_ID=ocid1.compartment.oc1..aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa OCI_REGION=us-chicago-1 ############################################################################### # Persistência ############################################################################### # Opções: memory, autonomous, mongodb -SESSION_REPOSITORY_PROVIDER=sqlite -MEMORY_REPOSITORY_PROVIDER=sqlite -CHECKPOINT_REPOSITORY_PROVIDER=sqlite -SQLITE_DB_PATH=./data/agent_framework.db +SESSION_REPOSITORY_PROVIDER=autonomous +MEMORY_REPOSITORY_PROVIDER=autonomous +CHECKPOINT_REPOSITORY_PROVIDER=autonomous # Autonomous Database ADB_USER=admin -ADB_PASSWORD=Moniquinha1972 -ADB_DSN=oradb23ai_high -ADB_WALLET_LOCATION=/mnt/d/Dropbox/ORACLE/LatinoAmerica/Wallet_ORADB23ai -ADB_WALLET_PASSWORD=Moniquinha1972 +ADB_PASSWORD=fjhsdf04954hf +ADB_DSN=oradb23aidev_high +ADB_WALLET_LOCATION=/ORACLE/DEFAULT/Wallet_ORADB23aiDev +ADB_WALLET_PASSWORD=fjhsdf04954hf ADB_TABLE_PREFIX=AGENTFW # MongoDB - também pode representar Autonomous usando API compatível com Mongo, se habilitada no ambiente @@ -70,13 +71,16 @@ RAG_FILE_GLOBS=*.md,*.txt,*.yaml,*.yml,*.json # Observabilidade ############################################################################### ENABLE_LANGFUSE=true -LANGFUSE_TRACE_MODE=compact # Opcional: verbose, compact -LANGFUSE_PUBLIC_KEY=pk-lf-2f9da109-5b0f-4c78-b61d-9598ed787eba -LANGFUSE_SECRET_KEY=sk-lf-a4cb0cdd-f2ea-4468-9911-cebeb91ba944 +LANGFUSE_TRACE_MODE=verbose # Opcional: verbose, compact +LANGFUSE_ROOT_SPAN_NAME=agent.gateway_message +LANGFUSE_LEGACY_IO_FALLBACK=true +LANGFUSE_PUBLIC_KEY=pk-lf-bd9b0c7e-2b8b-4e5b-a382-284a9b4413b3 +LANGFUSE_SECRET_KEY=sk-lf-5f5cc18d-0bb5-424e-b5d0-cb3664d58c20 LANGFUSE_HOST=http://localhost:3005 ENABLE_OTEL=false OTEL_EXPORTER_OTLP_ENDPOINT= OTEL_SERVICE_NAME=ai-agent-template +ENABLE_LANGFUSE_OPENAI_AUTO_INSTRUMENTATION=true ############################################################################### # Analytics / Observer corporativo @@ -121,6 +125,9 @@ PROMPT_POLICY_PATH=./config/prompt_policy.yaml # Gateway de canais ############################################################################### DEFAULT_CHANNEL=web +# embedded = backend may parse simple/native channel payloads. +# external = backend only accepts GatewayRequest normalized by an external Channel Gateway. +FRAMEWORK_CHANNEL_INPUT_MODE=embedded ENABLE_VOICE_ADAPTER=true ENABLE_WHATSAPP_ADAPTER=true ENABLE_TEXT_ADAPTER=true @@ -134,21 +141,33 @@ ROUTING_CONFIG_PATH=./config/routing.yaml # Em produção, costuma ser útil; em desenvolvimento, false evita custo e latência. ENABLE_LLM_ROUTER=true +# Semantic route stickiness (optional). +# Uses a lightweight LLM profile to decide only CONTINUE vs ROUTE. +# There are no regexes or deterministic language rules. +ENABLE_ROUTE_STICKINESS=false +ROUTE_STICKINESS_LLM_PROFILE=route_continuity +ROUTE_STICKINESS_CONFIDENCE_THRESHOLD=0.90 +ROUTE_STICKINESS_HISTORY_TURNS=2 +ROUTE_STICKINESS_MAX_TOKENS=80 +HUMAN_HANDOFF_MESSAGE=Vou encaminhar seu atendimento para uma pessoa. +END_SESSION_MESSAGE=Atendimento encerrado. Obrigado pelo contato. + ############################################################################### # MCP / Tools ############################################################################### ENABLE_MCP_TOOLS=true -MCP_SERVERS_CONFIG_PATH=./agent_template_backend/config/mcp_servers.yaml -TOOLS_CONFIG_PATH=./agent_template_backend/config/tools.yaml +MCP_SERVERS_CONFIG_PATH=./config/mcp_servers.yaml +TOOLS_CONFIG_PATH=./config/tools.yaml +TOOL_POLICIES_PATH=./config/tool_policies.yaml MCP_TOOL_TIMEOUT_SECONDS=30 # router = EnterpriseRouter seleciona um agente; supervisor = pode acionar múltiplos agentes ROUTING_MODE=router # Usage/cost accounting -USAGE_REPOSITORY_PROVIDER=sqlite -IDENTITY_CONFIG_PATH=./agent_template_backend/config/identity.yaml -MCP_PARAMETER_MAPPING_PATH=./agent_template_backend/config/mcp_parameter_mapping.yaml +USAGE_REPOSITORY_PROVIDER=autonomous +IDENTITY_CONFIG_PATH=./config/identity.yaml +MCP_PARAMETER_MAPPING_PATH=./config/mcp_parameter_mapping.yaml # ----------------------------------------------------------------------------- # ConversationSummaryMemory / compressão de contexto conversacional @@ -163,6 +182,18 @@ MEMORY_SUMMARY_USE_LLM=true MEMORY_INJECT_RECENT_MESSAGES=true MEMORY_INJECT_SUMMARY=true +############################################################################### +# MCP Gateway +############################################################################### +# true = framework routes tool calls to the dedicated MCP Gateway. +# false = framework calls MCP servers directly from mcp_servers.yaml. +MCP_GATEWAY_ENABLED=true +MCP_GATEWAY_URL=http://localhost:8300 +MCP_GATEWAY_TIMEOUT_SECONDS=60 +# MCP_GATEWAY_TOKEN= +MCP_GATEWAY_AGENT_ID=telecom_contas +MCP_GATEWAY_TENANT_ID=default + ############################################################################### # LONG-TERM MEMORY ############################################################################### diff --git a/.env.example b/.env.example index 98ad2e4..116eb7d 100644 --- a/.env.example +++ b/.env.example @@ -141,12 +141,24 @@ ROUTING_CONFIG_PATH=./config/routing.yaml # Em produção, costuma ser útil; em desenvolvimento, false evita custo e latência. ENABLE_LLM_ROUTER=true +# Semantic route stickiness (optional). +# Uses a lightweight LLM profile to decide only CONTINUE vs ROUTE. +# There are no regexes or deterministic language rules. +ENABLE_ROUTE_STICKINESS=false +ROUTE_STICKINESS_LLM_PROFILE=route_continuity +ROUTE_STICKINESS_CONFIDENCE_THRESHOLD=0.90 +ROUTE_STICKINESS_HISTORY_TURNS=2 +ROUTE_STICKINESS_MAX_TOKENS=80 +HUMAN_HANDOFF_MESSAGE=Vou encaminhar seu atendimento para uma pessoa. +END_SESSION_MESSAGE=Atendimento encerrado. Obrigado pelo contato. + ############################################################################### # MCP / Tools ############################################################################### ENABLE_MCP_TOOLS=true MCP_SERVERS_CONFIG_PATH=./config/mcp_servers.yaml TOOLS_CONFIG_PATH=./config/tools.yaml +TOOL_POLICIES_PATH=./config/tool_policies.yaml MCP_TOOL_TIMEOUT_SECONDS=30 # router = EnterpriseRouter seleciona um agente; supervisor = pode acionar múltiplos agentes @@ -194,4 +206,4 @@ LONG_TERM_MEMORY_TABLE=agentfw_long_term_memory LONG_TERM_MEMORY_MAX_CONTEXT_ITEMS=20 LONG_TERM_MEMORY_MIN_CONFIDENCE=0.70 LONG_TERM_MEMORY_AUTO_EXTRACT=true -LONG_TERM_MEMORY_INJECT_CONTEXT=true \ No newline at end of file +LONG_TERM_MEMORY_INJECT_CONTEXT=true diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 608fc10..03a129f 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,9 +4,7 @@