Unlock Contact Information Effortlessly: A Marvin Agent for Precise Data Extraction
Stop wasting time manually sifting through text for contact details. This article unveils a powerful Marvin agent that automates the extraction of structured contact information using the Agent2Agent (A2A) protocol. Learn how to effortlessly gather names, emails, phone numbers, and more, all while streamlining your workflow.
What is the Marvin Contact Extractor Agent?
This agent leverages the Marvin framework to intelligently extract contact details (name, email, phone, etc.) from any given text. Its capabilities include:
- Structured data extraction: Transforms unstructured text into neatly organized data.
- Multi-turn conversations: Gathers missing information through follow-up questions (e.g., asking for an email if it's not initially provided).
- A2A integration: Seamlessly communicates structured data with other agents for enhanced automation.
Key Benefits of Using this Marvin Agent
- Save Time: Automate a tedious task, freeing up your time for more important work.
- Improve Accuracy: Reduce errors associated with manual data entry.
- Increase Efficiency: Streamline your contact information gathering process from start to finish.
Components That Make it Tick
The Marvin contact extractor is built on these essential components:
ExtractorAgent (agent.py)
: The core logic that uses Marvin to extract data and manages conversations through dictionaries.AgentTaskManager (task_manager.py)
: Integrates the agent with the A2A protocol, handling task states and response formatting.A2A Server (__main__.py)
: Hosts the agent and task manager for easy access.
Setting Up Your Marvin Agent
Ready to get started? Here’s how to set up and run the Marvin contact extractor agent:
- Prerequisites: Make sure you have Python 3.12+, uv, and an OPENAI_API_KEY (or other LLM provider credentials).
- Navigate to the directory:
cd samples/python/agents/marvin
- Set up your API key:
export OPENAI_API_KEY=your_api_key_here
- Create a Python environment:
uv venv
source .venv/bin/activate
uv sync
- Run the server:
MARVIN_DATABASE_URL=sqlite+aiosqlite:///test.db MARVIN_LOG_LEVEL=DEBUG uv run
- Without MARVIN_DATABASE_URL set, conversation history will not be persisted by session id.
- Launch an A2A client in a separate terminal.
cd samples/python/hosts/cli
and thenuv run. --agent http://localhost:10030
Understanding the Extracted Data
The agent provides structured data in the following format:
This class ensures that you receive consistently formatted contact details, ready for use in your applications.
Where to Learn More
- [Marvin Documentation](link to documentation)
- [Marvin GitHub Repository](link to repository)
- [A2A Protocol Documentation](link to documentation)