Skip to main content
    Yara Brasil

    Yara transforms fertilizer market intelligence with generative AI on AWS

    Yara enhanced its strategic analysis of inputs and commodities with a unified query experience that is faster, contextualized and grounded in traceable evidence.

    Yara transforms fertilizer market intelligence with generative AI on AWS
    ClientYara Brasil
    Technologies
    AWSAmazon EC2Amazon ECSAWS LambdaAmazon EventBridgeAmazon BedrockAmazon AthenaAWS Glue Data CatalogAmazon S3Amazon ECRAmazon CognitoAmazon CloudWatchStreamlit
    Category
    Generative AI
    IndustryCommercial Intelligence

    Yara has centralized the consolidation of heterogeneous market data—including commodity quotes, import and export data, PDF reports, and market news—into a Generative AI architecture on AWS. By combining SQL query execution in Amazon Athena, semantic search in Amazon Bedrock Knowledge Bases, and synthesis by language models, the solution replaced manual routines with structured executive responses directly linked to evidence sources.

    Operating in a highly dynamic and complex global market, Yara needed to modernize and increase the agility of its market intelligence cycle, supporting strategic and procurement areas in the rapid interpretation of scenarios and decision-making regarding inputs and fertilizers. The previous analytical process was supported by manual, fragmented work, in which analysts had to constantly navigate between multiple heterogeneous data sources—such as news portals, specialized PDF reports, price time series, and import/export tabular databases—which increased response times and hindered the standardization of analyses. Despite the abundance of available information, the analytical routine presented significant limitations: sources had distinct update rhythms and formats, and there was no centralized means to automatically cross-reference quantitative data with recent textual contexts (such as geopolitical risks, production costs, and logistical impacts). Instead of relying on an integrated intelligence flow, the analyst themselves had to manually switch between several providers, interpret isolated series, and consolidate all evidence without automation until translating them into an executive recommendation.

    In practice, the market analyst had to deal with a fragmented and overly operational routine. It was necessary to manually navigate through multiple providers, interpret dense PDF reports, cross-reference historical price series with market news without centralized analytical support, and consolidate data with completely distinct formats and update rhythms. This format significantly increased the response time for intelligence generation, required high manual consolidation effort, and limited the team's ability to monitor risks with agility and support strategic purchase and supply decisions for fertilizers.

    The solution architecture was designed to operate with high resilience, governance, and traceability, establishing a clear separation between the ingestion, storage, semantic retrieval, and synthesis layers. Amazon EventBridge acts as the central orchestration, triggering scheduled routines that launch tasks in containers on Amazon ECS and functions on AWS Lambda. In data processing, Amazon ECS executes dedicated containers stored in Amazon ECR for news and quote scraping, text extraction from PDF reports, and automated generation of summaries and market alerts. For specific API integrations, such as collecting data from Agroconsult, AWS Lambda is used in isolation to reduce coupling.

    Amazon S3 acts as the solution's central data lake, storing raw files, structured data in Parquet format, extracted text, conversation history, and analytical artifacts. In the tabular analytical layer, Amazon Athena and the AWS Glue Data Catalog enable direct SQL queries for calculating trends, variations, and historical market series. Amazon Bedrock provides the Generative Artificial Intelligence foundation, using separate Knowledge Bases for semantic search in news and analytical reports, as well as language models responsible for query planning and traceable executive synthesis. The user interface is provided by a Streamlit application hosted on Amazon EC2 and authenticated via Amazon Cognito, while Amazon CloudWatch centralizes the operational monitoring of the infrastructure. This technological foundation enables a continuous and scalable market intelligence cycle, prepared to consolidate heterogeneous sources into strategic analyses with full traceability of evidence.

    Orchestration (Planner)

    Role: Interprets the analyst's question, identifies the business intent (fertilizer family, product, region, and time window), and plans search blocks in the appropriate tools.

    Essential control: Prevention of query loops, mitigation of analytical context loss, and strict routing according to the type of evidence required.

    Tabular Query (Athena Agent)

    Role: Builds and executes structured SQL queries in Amazon Athena to extract numerical indicators, price time series, costs, and supply/demand balances.

    Essential control: Granularity validation, guarantee of valid time windows, and explicit alerting in the face of short series to avoid undue extrapolations.

    Semantic Search (Retrieval Agent)

    Role: Performs parallel searches in Amazon Bedrock Knowledge Bases, retrieving situational data (news) and structural readings (reports).

    Essential control: Strict segregation between bases (news vs. reports) to avoid noise, filtering by recency/source metadata, and citation traceability.

    Executive Synthesis (Synthesizer)

    Role: Consolidates the package of tabular and textual evidence, generating the recommendation with purchasing implications, risks, uncertainties, and decision triggers.

    Essential control: Strict fidelity to retrieved evidence, prohibition of factual hallucination, and transparent explanation of information gaps.

    Memory and State (State Management)

    Role: Preserves the state of the conversational session, manages the interaction history, and stores supplementary uploads and response artifacts in S3.

    Essential control: User access isolation via Amazon Cognito, persistence management in S3 prefixes, and no contamination of official bases by temporary uploads.

    These agents can be implemented as specialized nodes within the same LangGraph (or Bedrock orchestrator) process. This characterizes a multi-agent architecture in a functional sense, without requiring that each agent have an independent endpoint or deployment cycle.

    Supporting Yara's Market Intelligence Agent requires resilience to handle query spikes during periods of high market volatility (such as crop releases or geopolitical impacts) and to execute asynchronous ingestion routines without environment degradation. To ensure continuity, consistency, and analytical reliability, the solution adopts the following practices:

    User State Isolation: Conversational state, preferences, and temporary uploads are strictly keyed by the analyst ID authenticated via Amazon Cognito and maintained in isolated Amazon S3 prefixes (market-intelligence-app/), preventing any leakage or cross-reading of searches between users.

    Concurrency Control and Checkpoints: The persistence of history and orchestration flow checkpoints uses optimistic concurrency control. This ensures that concurrent asynchronous executions—such as semantic searches in Amazon Bedrock and parallel SQL queries in Amazon Athena—update the state without overwriting information or generating out-of-order responses.

    Idempotency in Pipelines and Artifacts: Automated tasks for ingestion, PDF extraction, and generation of daily summaries and reports use idempotency keys (based on the hash of the original document and time window). This ensures that retries of schedules in Amazon EventBridge do not generate duplicate artifacts or overwritten summaries in the data lake.

    Failure Handling and Redrive: Messaging and orchestration flows feature configured retry policies, Dead-Letter Queues (DLQ), and redrive mechanisms for extraction and scraping tasks, in addition to isolation (circuit breakers) for external integrations vulnerable to third-party fluctuations, such as the Agroconsult API.

    Scaling and Service Quotas: The capacity of the processing cluster and containers was scaled via load tests considering concurrent request limits (TPS/RPM) of Amazon Bedrock and the parallelism supported by the Amazon Athena Workgroup, preventing bottlenecks during peak hours.

    Latency and Task Age Monitoring: Real-time tracking via Amazon CloudWatch monitors the age of queued tasks, the execution time of schedules in EventBridge, the latency of AI calls, and the update of partitions in S3/Athena, ensuring immediate diagnosis in case of deviations.

    In a strategic market intelligence journey, language guardrails are just an initial layer. The most critical frontier lies in strict evidence governance, granular control of AWS infrastructure access, and end-to-end traceability of the recommendations that support purchase and input supply decisions. The application validates server-side permissions, restricts query scopes in Amazon Athena and Amazon Bedrock Knowledge Bases, and completely isolates temporary artifacts sent by analysts from official databases.

    Identity

    Recommended control: Deterministic authentication via Amazon Cognito, linking sessions, conversation history, and file uploads to the analyst's profile.

    Authorization and IAM

    Recommended control: Access based on the Principle of Least Privilege with dedicated roles per executor (ecs-task-role, lambda-role, bedrock-agent-role), in addition to secure operational management via AWS Systems Manager (SSM).

    Evidence Governance

    Recommended control: Mandatory preservation of metadata (origin, date, path in S3) in all news and PDF reports, with physical segregation of semantic bases in Amazon Bedrock (conjunctural news vs. fundamental reports).

    Data Integrity

    Recommended control: Strict data segregation in Amazon S3 by logical prefixes (scraping-data/, reports/, market-intelligence-app/), ensuring that user uploads do not contaminate the official data lake.

    Transparency and Fallback

    Recommended control: Active disclosure in the generated response when there are short time series, outdated data, or scarcity of evidence, preventing hasty conclusions without data backing.

    Audit and Traceability

    Recommended control: Correlation and registration of traces linking the user question, the SQL query in Athena, citations from Knowledge Bases, logs in Amazon CloudWatch, and the final executive summary.

    Support based on AWS Managed Services closes the cycle between infrastructure stability and the agent's continuous analytical quality. In addition to incident management and monitoring of scheduled routines in Amazon EventBridge (ECS scrapers and integration Lambdas), the operation monitors the latency of AI calls, execution time of queries in Athena, consumption of Bedrock quotas, and continuous synchronization of Knowledge Bases, ensuring the system evolves without loss of precision or quality regression.

    In the indicators tracked by Yara's Market Intelligence Agent, the evaluation combines efficiency in generating strategic recommendations with the technical quality of multi-agent orchestration and the reliability of market evidence. The reading of these results is structured in layers ranging from the impact on the fertilizer purchasing cycle to the operational performance of the infrastructure on AWS.

    Business

    Metrics: Response time in intelligence generation, reduction of manual effort in consolidating sources, adoption rate of the daily report, engagement with high-impact market alerts, and agility in purchasing and supply decision-making.

    Agent

    Metrics: Accuracy in question planning (Planner), precision of SQL queries generated for Amazon Athena, relevance and fidelity of retrieval in Amazon Bedrock Knowledge Bases, citation rate of sources, and quality of the executive summary.

    Multi-agent

    Metrics: Efficiency in the chaining of specialized nodes (Planner, Athena Agent, Retrieval Agent, and Synthesizer), consistency in sharing analytical context, and absence of factual hallucinations.

    Security and Governance

    Metrics: Authentication validation via Amazon Cognito, compliance with the principle of least privilege in IAM Roles, isolation of uploads/history in S3 per user, and evidence traceability/auditing.

    Operation

    Metrics: p50/p95/p99 latency of calls in Amazon Bedrock and queries in Athena, token consumption, throughput, and success rate of scheduled pipelines in EventBridge/ECS (scrapers and extractors) and synchronization time of Knowledge Bases.

    Experience

    Metrics: Conversation turns required to close the analysis, clarity of the qualitative effect classification of alerts (from very positive to very negative), usefulness of daily summaries, and usability in sending complementary documents via upload.

    4x / day Automated frequency of news and market quote updates via scrapers executed on Amazon ECS.

    100% Traceability of executive recommendations with a direct link to the evidence and sources consulted.

    MCP standardizes how agents access tools and context. A2A is suitable when agents are independent services, with their own endpoints, responsibilities, and deployment cycles. When components share the same LangGraph process and the same state, coordination can occur without A2A.

    As the maturity of Yara's Market Intelligence Agent advances, the architecture can evolve to incorporate Amazon Bedrock AgentCore, a modular layer for executing, governing, and operating agents at scale. The adoption of this evolution can occur incrementally and without interruptions: observability and evaluation capabilities can be applied immediately over the existing workload in Amazon ECS / EC2, while Runtime, Gateway, Memory, Identity, and Policy enter gradually as required by the complexity of the analyses.

    Mapping of Architecture Evolution

    EC2 / ECS + Streamlit

    AgentCore Capability: AgentCore Runtime

    Objective and Impact on Case: Managed hosting and complete isolation of the analytical session execution environment.

    Amazon S3 / App State

    AgentCore Capability: AgentCore Memory

    Objective and Impact on Case: Unified management of short-term conversational context and long-term analytical memory (analyst preferences and search history).

    Athena, Lambdas and Bedrock KBs

    AgentCore Capability: AgentCore Gateway + MCP

    Objective and Impact on Case: Standardization of tools via Model Context Protocol (MCP) with strict schemas, authentication, and governance for querying fertilizer bases, quotes, and reports.

    Amazon Cognito + IAM Roles

    AgentCore Capability: AgentCore Identity + Policy

    Objective and Impact on Case: Workload identity management and application of deterministic limits on which market data each user profile can consult.

    Amazon CloudWatch

    AgentCore Capability: AgentCore Observability

    Objective and Impact on Case: Detailed traceability (traces) of planning stages, SQL calls to Athena, and retrieval in Knowledge Bases.

    Ad-hoc tests and validations

    AgentCore Capability: AgentCore Evaluations

    Objective and Impact on Case: Automated evaluations (online, on-demand, and in batch) of the accuracy and fidelity of generated responses against evidence.

    Practical Distinction: MCP vs. A2A vs. Internal Orchestration

    To expand the capacity of Yara's intelligence ecosystem, it is fundamental to correctly position the role of MCP (Model Context Protocol) and A2A (Agent-to-Agent):

    MCP

    Relationship: Agent to tool, resource, or context

    Practical Use in Yara Case: Standardizes how the agent consumes external connectors — such as SQL queries in Amazon Athena, semantic search in Bedrock Knowledge Bases, or integration with the Agroconsult API.

    A2A (Agent-to-Agent)

    Relationship: Agent to another independent agent

    Practical Use in Yara Case: Enables collaboration between the Market Intelligence Agent and other autonomous corporate agents at Yara (e.g., a Supply Planning Agent or Global Logistics Agent), each with its own lifecycle and endpoint.

    Internal Orchestration (Graph/Process)

    Relationship: Nodes in the same execution process

    Practical Use in Yara Case: Coordinates internal specialized roles (Planner, Athena Agent, Retrieval Agent, and Synthesizer) within the same application, sharing the same memory state without the overhead of protocols between services.

    Architecture Direction: MCP establishes a universal standard for the agent to access tools and market data sources in a secure and declarative way. The A2A protocol is indicated when multiple agents operate as independent microservices with distinct business responsibilities. As long as the query keeps analytical nodes integrated in the same application orchestration flow, direct internal coordination ensures lower latency and greater operational simplicity.

    Start with the decision that requires control: Map what the model can synthesize freely and what requires deterministic SQL queries in Amazon Athena or rigid metadata filters in Knowledge Bases.

    Design reprocessing before scale: The persistence of intermediate artifacts in logical Amazon S3 prefixes and the decoupling of routines via Amazon EventBridge prevent the need to rerun entire pipelines in case of failures and protect the application against ingestion bottlenecks.

    Measure analytical utility, not just text fluidity: A well-written response that lacks links to recent quotes or fails to distinguish between cyclical context and long-term structural readings does not resolve the decision-making needs of procurement and strategy departments.

    Separate protocol from topology: Multiple specialized roles (such as Planner, Athena Agent, Retrieval Agent, and Synthesizer) integrated into the same orchestration flow do not require A2A communication; the MCP standard is the appropriate path for disciplining connections to external tools and bases.

    Evidence and traceability come before synthesis: Executive recommendations must be preceded by the transparent selection, ranking, and grouping of quantitative and textual evidence, ensuring every conclusion carries an explicit link to its sources.

    Operation and governance are part of the product: The maintenance of analytical quality depends on continuous monitoring of the scraping cycle, execution times for Athena queries, synchronization of semantic bases, and auditing of access permissions.

    The Yara Market Intelligence Agent transforms a manual, scattered, and fragmented analytical routine into a unified, agile, and contextualized query journey. The core value of the solution does not consist of granting unrestricted autonomy to the language model, but in integrating in a coordinated manner structured queries in Amazon Athena, semantic search isolated by document profile in Amazon Bedrock, and executive synthesis directly traceable to evidence on the fertilizer and inputs market.

    This architectural foundation establishes a mature base that allows for the evolution of the analytical experience, the incorporation of new external sources, and the progressive evaluation of Amazon Bedrock AgentCore capabilities as the operation demands greater isolation, declarative tool governance via MCP, detailed observability, and collaboration between independent corporate agents.

    The main gains of the Market Intelligence Agent project for Yara include:

    Agility and Reduction of Manual Effort: Replacement of the manual and fragmented query process—in which analysts had to switch between multiple providers, PDF reports, news portals, and tabular bases—with a single centralized interface, significantly reducing response time and eliminating the operational work of consolidation.

    Evidence-Based Purchasing Decisions: Automated combination of numerical tabular indicators (queried via Athena), recent cyclical signals (news), and structural medium/long-term analyses (market reports). This generates executive analyses that guide direct purchasing strategies, the anticipation or postponement of fertilizer acquisitions, detailing operational implications, risks, uncertainties, and monitoring triggers.

    Traceability and Mitigation of Hallucinations: Assurance that executive synthesis is generated only after the selection and ranking of evidence, linking every conclusion directly to its original sources and metadata.

    Automated Triage and High-Impact Alerts: Scheduled execution of update routines that generate daily market reports and risk and opportunity alerts. This layer identifies critical events (such as price variations, supply constraints, logistics bottlenecks, and input costs) for immediate user attention, without diluting them in extensive documents.

    Standardization and Reusable Foundation: Standardization of the criteria and quality of analyses delivered to procurement and strategy areas, establishing a modular cloud (AWS) foundation prepared to receive new indicators, data sources, and analytical dashboards in the future.

    Amazon Web Services (AWS)

    Amazon Web Services (AWS) is the world's most comprehensive and broadly adopted cloud platform, offering over 200 fully featured services from data centers globally. Millions of customers, including the fastest-growing startups, largest enterprises, and leading government agencies, are using AWS to lower costs, become more agile, and innovate faster.

    Want to achieve results like these in your company?

    Talk to our specialists and discover how we can boost your business's digital transformation.