Developing Custom Marketing Agents: A Digital Marketing and Advertising Agency Blueprint
Reading Time: 21 min

Key Takeaways
- Fix the workflow before automating it — most marketing tech problems are broken processes in disguise.
- Agents ≠ automation ≠ chatbots — agents pursue objectives and make bounded decisions; automation follows fixed rules; assistants just respond to prompts.
- Follow a phased blueprint — define outcome → map workflow → build knowledge layer → connect tools → set boundaries → test → deploy gradually → measure.
- Avoid common pitfalls — broken processes, unrestricted data access, output-volume metrics instead of business outcomes, skipping testing.
- Pilot small, expand with evidence — a 90-day roadmap starting with one measurable use case beats a broad "AI transformation
Marketing teams rarely struggle because they lack software. They struggle because their systems do not work together.
Campaign data sits in advertising platforms. Leads enter a CRM with incomplete information. Content approvals disappear inside email threads. Reports take hours to prepare, yet still fail to explain what should happen next.
A capable digital marketing and advertising agency can address this operational fragmentation by developing custom marketing agents: AI-powered systems designed to monitor information, make controlled decisions and complete defined tasks across the marketing stack.
This guide explains what marketing AI agents are, where they create value, how they should be developed and what businesses in Dubai and across the GCC must consider before introducing them into live marketing operations.
What Is a Custom Marketing Agent?
A custom marketing agent is an AI-enabled software system designed to complete a defined marketing objective using company data, business rules and connected tools. Unlike a general chatbot, it can analyse inputs, choose an appropriate action, use approved systems and evaluate the result within controlled boundaries.
A marketing agent normally combines five capabilities:
- A defined business objective
- Access to relevant knowledge and data
- Reasoning or decision logic
- Tools that allow it to take action
- Controls governing what it may do independently
For example, an agent might monitor incoming leads, identify their source, assess their suitability, assign them to the correct sales representative and trigger an approved WhatsApp or email follow-up.
That is different from asking an AI tool to draft a message. The first system participates in a workflow; the second simply generates content.
Automation, AI Assistants and AI Agents Compared
| Capability | Rule-Based Automation | AI Assistant | Custom Marketing Agent |
|---|---|---|---|
| Main function | Executes predefined rules | Responds to user prompts | Pursues a defined objective |
| Handles unfamiliar inputs | Poorly | Partially | Within configured limits |
| Selects its next action | No | Usually not | Yes |
| Uses business context | Limited fields | Prompt-based context | Connected knowledge and data |
| Takes action in other systems | Through fixed integrations | Occasionally | Through approved tools and APIs |
| Evaluates results | Rarely | When asked | Can monitor and adapt |
| Human supervision | Required for exceptions | Required for most actions | Set according to risk |
| Best use | Repetitive, predictable tasks | Research and drafting | Multi-step, decision-based workflows |
Business takeaway: Use conventional automation when the process is stable and every condition can be written as a rule. Consider an AI agent when the process requires interpretation, prioritisation or decisions based on changing context.
Why Marketing Operations Need More Than Another AI Tool
Most marketing technology problems are process problems in disguise. Adding an AI application to an unclear workflow can make the operation faster without making it better. Successful marketing operations automation begins by identifying where information, decisions and ownership break down.
Common symptoms include:
- Leads reaching sales teams without source or intent data
- Different departments using conflicting customer records
- Reports describing performance without recommending action
- Campaign budgets continuing to run after conversion quality declines
- Content being recreated because approved material is difficult to find
- Customer enquiries receiving inconsistent responses across channels
- Manual transfers between advertising, CRM and communication platforms
- Local and regional campaigns using outdated offers or compliance language
Traditional integrations can move information from one system to another. Custom agents can add a controlled layer of interpretation.
An agent might recognise that a healthcare lead submitted an enquiry for a specific treatment, determine the appropriate facility, confirm that the enquiry falls within operating hours and prepare a compliant response for review. Another agent might detect that a campaign is generating leads but few appointments, then investigate response time, channel, location and audience quality before alerting the marketing manager.
The value lies in connecting data to the next useful decision.
Where Marketing AI Agents Create Practical Value
Marketing AI agents can support planning, execution, measurement and customer communication. The strongest use cases usually involve frequent tasks, several data sources and a clear outcome that can be measured.
1. Campaign Monitoring and Anomaly Detection
A campaign-monitoring agent can retrieve performance data from advertising and analytics platforms, compare it with historical ranges and identify unusual changes.
It may flag:
- A sudden increase in cost per lead
- Falling conversion rates on a landing page
- Advertising spend with no recorded conversions
- High lead volume but low sales acceptance
- Creative fatigue within a specific audience
- Broken tracking or missing campaign parameters
The agent should not automatically change budgets simply because one metric moved. It needs minimum data thresholds, attribution context and escalation rules.
2. Lead Qualification and Routing
A lead management company can standardise information from website forms, paid campaigns, social platforms, phone systems and WhatsApp.
It can then:
- Validate contact details
- Remove obvious spam or duplicates
- Classify the enquiry
- Assess declared intent
- Enrich the CRM record
- Assign the correct team or location
- Trigger an approved acknowledgement
- Escalate high-value or urgent enquiries
For businesses operating across Dubai, Abu Dhabi, Riyadh and other GCC markets, routing may also depend on language, geography, service availability and local working hours.
3. Content Operations
A content agent can help teams research, structure, repurpose and govern marketing assets without becoming an unsupervised publishing engine.
Useful applications include:
- Building briefs from approved keyword and audience data
- Retrieving brand, product and service information
- Checking drafts against tone and terminology rules
- Identifying unsupported claims
- Adapting approved content for different channels
- Managing version control and approval status
- Suggesting contextual internal links
- Flagging outdated prices, dates or offers
Human review remains important for medical, financial, legal, reputational and culturally sensitive content.
4. SEO Operations
AI automation for digital marketing can reduce the manual effort involved in recurring SEO analysis.
An SEO agent may:
- Monitor indexing and crawling changes
- Group search queries by intent
- Identify content gaps
- Detect declining pages
- Compare metadata across templates
- Locate internal-link opportunities
- Flag cannibalisation risks
- Connect organic traffic with conversions
- Prioritise technical issues by potential impact
The agent should recommend action using real site data. It should not publish large volumes of speculative content or make technical changes without testing.
5. Customer Journey Orchestration
An orchestration agent can coordinate communication across email, SMS, WhatsApp and CRM systems based on customer behaviour.
For example:
- A prospect downloads a guide.
- The agent records the content topic and source.
- It checks whether the prospect is already known to the business.
- It selects an approved follow-up path.
- Engagement data updates the lead record.
- A sales task is created when buying intent crosses a threshold.
- Follow-up stops if the person opts out or becomes a customer.
This requires strict consent, frequency and suppression controls. Personalisation should improve relevance, not create the impression that a business is monitoring every action.
6. Reporting and Decision Support
A reporting agent can combine data from advertising, analytics, CRM and revenue systems to answer questions that channel dashboards cannot.
Instead of reporting that a campaign produced 500 leads, it can examine:
- How many were valid
- How many received timely follow-up
- How many became appointments or opportunities
- Which audiences generated qualified demand
- Which campaigns influenced revenue
- Where prospects left the journey
- What action the team should consider next
This turns reporting from a presentation task into a decision process.
The Marketing Agent Opportunity Matrix
Not every workflow deserves an agent. This matrix helps businesses prioritise opportunities according to frequency, decision complexity, risk and data readiness.
| Workflow | Frequency | Decision Complexity | Business Risk | Data Readiness | Recommended Approach |
|---|---|---|---|---|---|
| Weekly report preparation | High | Medium | Low | High | Strong first-agent candidate |
| UTM validation | High | Low | Low | High | Use rule-based automation |
| Lead classification | High | Medium | Medium | Medium–high | Agent with confidence thresholds |
| Content quality checks | High | Medium | Medium | High | Agent-assisted human review |
| Campaign budget changes | High | High | High | High | Recommendation agent first |
| Public social replies | High | High | High | Medium | Draft only; human approval |
| Offer and price updates | Medium | Low | High | Medium | Structured automation with approval |
| Strategic campaign planning | Low | Very high | High | Variable | Human-led with agent support |
| Medical claim approval | Medium | Very high | Very high | Variable | Qualified human approval required |
Quick Decision Tree
Use a custom agent when the answer to most of these questions is "yes":
- Does the workflow occur frequently?
- Does it require information from several systems?
- Does it include a judgement rather than a simple rule?
- Can success and failure be measured?
- Are the permitted actions clearly definable?
- Can sensitive decisions be escalated to a person?
- Is the underlying data sufficiently reliable?
If the task has one predictable trigger and one predictable action, conventional automation is usually simpler, cheaper and easier to maintain.
A Blueprint for AI Agent Development
Effective AI agent development is not primarily a model-selection exercise. It is an operating-model project involving workflow design, data governance, integration, evaluation and accountability. The following blueprint keeps the technology tied to a measurable business outcome.
Phase 1: Define the Operational Outcome
Begin with the result, not the proposed agent.
A weak objective is:
Automate lead management with AI.
A stronger objective is:
Reduce the time between a qualified website enquiry and assignment to the correct sales representative, while maintaining accurate CRM records and consent controls.
Define:
- The current process
- The process owner
- The desired outcome
- The baseline performance
- The users affected
- The cost of errors
- The decisions involved
- The actions the system may take
- The conditions requiring human review
This becomes the agent's operating brief.
Phase 2: Map the Workflow Before Automating It
Document the workflow from trigger to completion.
For every step, record:
| Workflow Element | Questions to Answer |
|---|---|
| Trigger | What begins the process? |
| Inputs | What data is required? |
| Decision | What judgement must be made? |
| Action | What should happen next? |
| System | Where does that action occur? |
| Owner | Who is accountable? |
| Exception | What can go wrong? |
| Evidence | How is the action recorded? |
| Outcome | How is success measured? |
This exercise often reveals duplicate approvals, missing data and conflicting ownership. Correct those issues before introducing AI workflow automation.
Phase 3: Design the Agent's Knowledge Layer
The agent needs access to reliable information, not unrestricted access to every company file.
Its knowledge base may include:
- Brand and editorial guidelines
- Product and service information
- Approved claims
- Campaign objectives
- Audience definitions
- Qualification criteria
- Customer service procedures
- Market-specific terminology
- Escalation policies
- Frequently asked questions
- Previous approved content
- Consent and communication rules
Documents should have owners, review dates and version status. If expired offers and current offers appear equally authoritative, the agent cannot reliably choose between them.
Phase 4: Connect the Required Tools
The agent may need controlled access to:
- CRM platforms
- Website content management systems
- Google Analytics
- Search Console
- Advertising platforms
- Social media tools
- Email platforms
- WhatsApp Business API
- SMS gateways
- ERP or inventory systems
- Project-management software
- Data warehouses
- Business intelligence dashboards
Where platforms provide APIs, the agent can retrieve data or complete approved actions programmatically. For example, the Google Ads API supports use cases including reporting, account management and ad operations in complex environments. Google also recommends test accounts for evaluating implementations before production use. Google Ads API and Google Ads test-account guidance..
Apply least-privilege access: the agent should receive only the permissions needed for its task.
Phase 5: Define Reasoning, Rules and Boundaries
An agent should know not only what it can do, but also when it must stop.
Specify:
- Available actions
- Prohibited actions
- Spending limits
- Confidence thresholds
- Approval requirements
- Restricted data
- Escalation triggers
- Communication limits
- Permitted markets and languages
- Required evidence and citations
- Rollback procedures
A reporting agent may independently retrieve and analyse data but require approval before changing a campaign. A lead-routing agent may assign standard enquiries automatically but escalate ambiguous, sensitive or high-value cases.
Phase 6: Build Human Approval Around Risk
Autonomy should depend on the consequence of an incorrect action.
| Risk Level | Example | Appropriate Control |
|---|---|---|
| Low | Tagging a report | Automatic action with logging |
| Moderate | Classifying a lead | Automatic above a confidence threshold |
| Significant | Sending a customer message | Approved templates or human review |
| High | Changing campaign budgets | Recommendation plus approval |
| Very high | Publishing regulated claims | Qualified human authorisation |
The goal is not maximum autonomy. It is the minimum supervision required to maintain acceptable quality, safety and accountability.
Phase 7: Test the Complete Workflow
Testing should cover more than whether the agent produces a plausible answer.
Evaluate:
- Task completion accuracy
- Tool-selection accuracy
- Data retrieval
- Decision consistency
- Brand and policy compliance
- Handling of incomplete inputs
- Permission boundaries
- Escalation behaviour
- Response time
- Cost per completed workflow
- Audit-log completeness
- Recovery after tool failure
Create adversarial scenarios. What happens if the CRM is unavailable? What if the lead enters contradictory information? What if a campaign name resembles another market's campaign? What if a source document is outdated?
Phase 8: Deploy Gradually
A sensible deployment path includes four levels:
- Observation: The agent analyses activity but takes no action.
- Recommendation: It proposes actions for a person to approve.
- Limited execution: It acts only in low-risk scenarios.
- Controlled autonomy: It completes approved workflows and escalates exceptions.
This provides evidence before authority is expanded.
Phase 9: Measure Business and System Performance
Track operational, commercial and governance metrics together.
Operational metrics
- Time saved
- Completion time
- Exception rate
- Manual intervention rate
- Workflow volume
- System availability
Commercial metrics
- Cost per qualified lead
- Lead-to-opportunity rate
- Appointment rate
- Campaign contribution
- Revenue influenced
- Customer retention
Quality and governance metrics
- Decision accuracy
- Incorrect-action rate
- Compliance exceptions
- Approval rejection rate
- Data freshness
- Traceability
- Customer complaints
An agent can become faster while becoming less useful. Business outcomes must remain the final measure.
The CONTROL Framework for Marketing Agents
Businesses can use the CONTROL Framework to assess every proposed agent:
| Principle | Meaning | Key Question |
|---|---|---|
| C — Clear outcome | The agent serves a measurable objective | What business result should improve? |
| O — Owned process | A person remains accountable | Who is responsible for its decisions? |
| N — Necessary data | Only relevant, reliable data is used | Is the source accurate and current? |
| T — Tool boundaries | Permissions are restricted | What actions are allowed or prohibited? |
| R — Risk-based review | Oversight matches potential harm | When must a person intervene? |
| O — Observable actions | Decisions and tool calls are logged | Can every action be investigated? |
| L — Learning cycle | Performance is reviewed systematically | How will errors improve the workflow? |
This framework prevents a common mistake: evaluating an agent only by the quality of its generated language.
What Most Businesses Miss
The hardest part of AI marketing automation is rarely the model. It is the operational environment surrounding it.
Data Quality Becomes Decision Quality
An agent connected to inaccurate CRM records will automate inaccurate conclusions. Before deployment, standardise critical fields, resolve duplicates, define lifecycle stages and identify the authoritative source for each type of data.
Someone Must Own the Process
IT may maintain the infrastructure, while marketing defines the workflow. Neither arrangement removes the need for a named business owner who approves rules, reviews exceptions and accepts accountability.
Memory Needs Governance
An agent may retain customer preferences, previous decisions or workflow context. Businesses must define what can be remembered, how long it can be stored and when it must be deleted.
The Last Mile Determines ROI
An agent might identify a high-value lead perfectly. If the assigned representative does not respond, no commercial value is created. Measurement must cover the complete journey, not just the agent's output.
More Agents Can Create More Complexity
A multi-agent system is not automatically better than one focused agent. Each additional agent introduces coordination, monitoring and failure points. Start with the smallest architecture capable of completing the workflow.
Current Google Cloud guidance similarly treats agent architecture and design-pattern selection as an iterative decision based on workload characteristics rather than a single default structure. Google Cloud agent architecture guidance.
Costs of Developing a Custom Marketing Agent
There is no credible universal price because costs depend on workflow complexity, integrations, data condition, security requirements and expected usage. A narrow reporting agent is fundamentally different from a customer-journey agent acting across multiple markets and communication channels.
Main Cost Drivers
| Cost Driver | Lower-Complexity Scenario | Higher-Complexity Scenario |
|---|---|---|
| Workflow | One structured process | Several conditional processes |
| Integrations | One or two standard platforms | Multiple proprietary or legacy systems |
| Data | Clean, centralised records | Fragmented or inconsistent records |
| Actions | Analysis and recommendations | External messages or account changes |
| Languages | One language | Arabic, English and regional variations |
| Compliance | General marketing | Healthcare, finance or sensitive data |
| Availability | Scheduled operation | Near-continuous monitoring |
| Evaluation | Basic acceptance testing | Formal test suites and ongoing audits |
| Scale | One brand or market | Multiple brands, countries or teams |
Budget for discovery, development, integration, testing, deployment, monitoring and maintenance. Model usage is only one component of the total cost.
How to Estimate Potential ROI
Use a conservative calculation:
Annual operational value
= Hours saved × loaded hourly cost × adoption rate
Plus commercial value
= Additional qualified outcomes × average contribution per outcome
Minus total cost
= Development + integration + usage + maintenance + oversight
Also calculate the value of faster response, reduced reporting delays and fewer process errors. Avoid assigning revenue to the agent when other changes—such as a new offer or larger advertising budget—also influenced performance.
Risks and How to Control Them
Custom agents introduce operational advantages, but they also create new failure modes. Trust depends on making those risks visible and manageable.
Inaccurate Decisions
Models can misinterpret ambiguous data or produce unsupported conclusions.
Control: Use structured sources, evidence requirements, confidence thresholds and human escalation.
Excessive Permissions
An agent with broad access can create greater damage when it fails.
Control: Apply least-privilege access, action limits and separate permissions for reading, drafting, publishing and spending.
Privacy and Consent Failures
Marketing workflows may involve names, contact details, preferences and behavioural data.
Control: Define lawful data use, retention, access and deletion processes. Obtain appropriate legal guidance for the markets and industries involved.
Brand and Cultural Errors
Messages suitable for one GCC market may be inappropriate in another.
Control: Maintain market-specific guidance, approved terminology and local review for sensitive communication.
Automation Bias
Employees may accept agent recommendations without checking the evidence.
Control: Display sources, confidence and assumptions. Train users to challenge the output.
Silent Workflow Failure
An agent may appear active while an API, tracking tag or CRM connection has stopped working.
Control: Monitor tools, log failures and alert owners when expected data is missing.
Common Implementation Mistakes
Avoid these recurring errors:
- Starting with a broad "AI transformation" instead of one defined workflow
- Automating a broken process
- Giving the agent access to uncurated documents
- Measuring output volume instead of business outcomes
- Connecting production systems before controlled testing
- Allowing public publishing without suitable review
- Ignoring exceptions and edge cases
- Giving one agent excessive responsibility
- Failing to document ownership
- Treating implementation as a one-time project
- Using personalisation without adequate consent
- Assuming generated reports are automatically correct
Consultant tip: Begin with a high-frequency, low-risk workflow that already has structured data. Reporting analysis, content quality assurance and lead classification are often stronger starting points than autonomous budget management.
When to Build, Buy or Combine
Businesses do not always need custom development. The right approach depends on strategic importance, differentiation and technical complexity.
| Choose | When It Fits | Main Limitation |
|---|---|---|
| Off-the-shelf tool | The workflow is standard and speed matters | Limited custom logic |
| Native platform automation | The task stays within one platform | Weak cross-platform context |
| Custom agent | The workflow is distinctive and spans systems | Greater development responsibility |
| Hybrid approach | Standard tools cover part of the process | Requires careful orchestration |
| No agent | Rules can solve the task reliably | Less flexibility for interpretation |
A digital marketing and advertising agency with strategy, data, media and development capabilities can help determine which parts need an agent and which are better handled through CRM rules, platform automation or conventional integrations.
A 90-Day Implementation Roadmap
A focused first deployment can usually be organised into four stages. The timeline should expand when the workflow involves sensitive data, regulated claims, custom infrastructure or several business units.
Days 1–15: Discover
- Select one measurable use case
- Map the current process
- Record baseline performance
- Identify stakeholders and owners
- Audit data and systems
- Classify operational risk
Days 16–35: Design
- Define the knowledge base
- Specify tools and permissions
- Write decision and escalation rules
- Design the human-review process
- Create evaluation scenarios
- Confirm success metrics
Days 36–65: Build and Test
- Configure the agent
- Connect test environments
- Validate data retrieval
- Test standard and unusual cases
- Review privacy and security controls
- Train intended users
Days 66–90: Pilot and Improve
- Deploy in observation mode
- Compare recommendations with human decisions
- Permit limited low-risk actions
- Track errors and interventions
- Review business impact
- Decide whether to expand, revise or stop
Quick Readiness Checklist
Before approving AI agent development, confirm that:
- The business outcome is measurable.
- The workflow is documented.
- A process owner has been named.
- Data sources are reliable and current.
- System permissions can be restricted.
- High-risk actions require approval.
- Exceptions and failure scenarios are documented.
- Decisions and tool calls will be logged.
- Privacy and consent requirements have been reviewed.
- Success includes commercial and quality metrics.
- Users will be trained.
- Maintenance has an owner and budget.
If several answers remain unclear, the business is not yet ready to give an agent operational authority.
How Custom Agents Fit into an Integrated Digital Ecosystem
Marketing agents become more valuable when they support a connected customer journey rather than an isolated department.
An SEO agent may identify high-intent demand. Website developmentt determines whether visitors can act on that demand. Performance marketing supplies campaign data. CRM and ERP integrations create a consistent customer record. Whatsapp Business API and SMS systems support timely communication. Analytics connects activity with commercial outcomes.
For example:
- SEO and paid media attract a prospect.
- The website captures consent and structured enquiry details.
- A lead agent validates and classifies the request.
- The CRM stores the customer record.
- WhatsApp or email sends an approved acknowledgement.
- Sales receives the lead with relevant context.
- Reporting connects acquisition source with the final outcome.
This is where a digital marketing and advertising agency can add value beyond developing a standalone tool: aligning strategy, channels, technology and operational ownership around the same customer journey.
Frequently Asked Questions
What is a marketing AI agent?
A marketing AI agent is a software system that uses artificial intelligence, business data and connected tools to pursue a defined marketing objective. It may analyse information, choose an action and complete approved tasks such as classifying leads, preparing reports or checking content. Its authority should be limited by permissions, confidence thresholds and human-approval rules.
How is a marketing agent different from marketing automation?
Marketing automationn follows predefined triggers and rules. A marketing agent can interpret context and select between permitted actions when the correct next step is not fully predictable. Automation is usually better for simple, repetitive processes. Agents are more useful when workflows involve unstructured data, several systems or context-dependent decisions.
What marketing tasks should be automated first?
Start with frequent, measurable and relatively low-risk tasks. Good candidates include performance-report preparation, campaign anomaly detection, lead classification, CRM record enrichment, content compliance checks and internal-link recommendations. Avoid beginning with unrestricted campaign spending, public publishing or regulated customer communication.
Can AI agents manage advertising campaigns automatically?
They can retrieve campaign data, identify anomalies, prepare recommendations and, with suitable platform access, complete certain approved actions. However, autonomous budget or bidding changes carry financial risk. Most businesses should begin with recommendation mode, establish reliable evaluation criteria and require approval until the system demonstrates consistent performance.
Do small and medium-sized businesses need custom marketing agents?
Only when the workflow justifies the investment. A smaller business may gain more from improving CRM discipline or implementing standard automation first. Custom development becomes more attractive when manual operations consume substantial time, several tools must be coordinated or the company has distinctive qualification, reporting or customer-journey requirements.
How long does AI agent development take?
A focused pilot may be developed within several weeks, but production readiness depends on integrations, data quality, security, testing and approval requirements. Multi-market or regulated workflows normally take longer. Discovery should establish a realistic schedule after the current process and systems have been examined.
Are marketing AI agents safe?
They can be operated responsibly when the business restricts permissions, protects data, logs actions, tests failure scenarios and retains human authority over consequential decisions. No agent should be considered safe merely because it performs well in a demonstration. Safety depends on the entire operating environment.
How should a business choose an AI agent development partner?
Look for combined expertise in workflow analysis, marketing operations, data integration, software development, security and performance measurement. The partner should be willing to recommend conventional automation when an agent is unnecessary. Ask how it tests decisions, limits permissions, handles failures and measures commercial outcomes after deployment.
Conclusion
Custom marketing agents are most useful when they remove a specific operational constraint: slow lead routing, disconnected reporting, inconsistent content control or fragmented customer communication.
The right starting point is not maximum autonomy. It is a clearly owned workflow, reliable data, limited permissions and a measurable outcome. From there, authority can expand only when testing and live evidence justify it.
As a digital marketing and advertising agency, Wisoft Solutions can you connect AI agent development with SEO, paid media, websites, CRM, WhatsApp, SMS and reporting infrastructure. The objective is not to add AI for appearance's sake, but to build a marketing operation that makes faster, more consistent and better-informed decisions.
A practical first step is to identify one recurring workflow, calculate its current cost and assess whether rules, standard automation or a custom agent offers the strongest solution.