The Composer Agent is a project that leverages Lyria for music generation, integrated within the Google Agent Development Kit (ADK) framework. It provides an intelligent agent capable of composing music based on user prompts and parameters, with a user-friendly chat interface for interaction.
- AI-Powered Music Composition: Utilizes Lyria, Google's foundation model for high-quality audio generation, to create unique musical pieces.
- Interactive Chat Interface: Built with Chainlit to provide a seamless user experience for requesting and receiving music compositions.
- Agent-Based Architecture: Implemented with Google's Agent Development Kit (ADK) for robust and scalable agent interactions.
- Multi-Agent System: Consists of a director agent that understands user intent and a composer agent that generates music.
- Customizable Music Generation: Supports detailed prompts including genre, mood, instrumentation, tempo, and more.
- Audio Playback: Directly plays generated music in the chat interface.
Before you begin, ensure you have met the following requirements:
- Python 3.12 or higher
- Access to Google Cloud Project with Lyria API enabled
- Google Cloud credentials configured
piporuvfor installing Python packagesgitfor cloning the repository
-
Clone the repository:
git clone https://github.com/soundtricker/composer-agent.git cd composer-agent -
Set up virtual environments for each component:
For the agents component:
cd apps/agents python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate pip install -e .
For the chatui component:
cd ../chatui python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate pip install -e .
-
Configure environment variables:
For the agents component, create a
.envfile inapps/agents/composer/with:GOOGLE_GENAI_USE_VERTEXAI=1 GOOGLE_CLOUD_PROJECT=your-project-id GOOGLE_CLOUD_LOCATION=your-locationFor the chatui component, create a
.envfile inapps/chatui/with:GOOGLE_CLOUD_PROJECT=your-project-id GOOGLE_CLOUD_LOCATION=your-location BACKEND_TYPE=your-backend-type BACKEND_URL=your-backend-url GOOGLE_CLOUD_AGENT_ENGINE_ID=your-agent-engine-id CHAINLIT_AUTH_SECRET=your-auth-secret
-
Navigate to the chatui directory:
cd apps/chatui -
Activate the virtual environment:
source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Start the Chainlit application:
chainlit run main.py
-
Open your browser and navigate to the URL displayed in the terminal (typically http://localhost:8000).
- Start a conversation by describing the type of music you want to create.
- The agent will ask clarifying questions about genre, mood, instrumentation, etc.
- Once the agent has enough information, it will generate music based on your specifications.
- The generated music will be played directly in the chat interface.
- You can request modifications or create new compositions as needed.
composer-agent/
├── LICENSE
├── README.md
└── apps/
├── agents/ # Agent implementation
│ ├── composer/ # Main composer agent
│ │ ├── agent.py # Root agent implementation
│ │ ├── prompts.py # Prompts for the root agent
│ │ └── sub_agents/ # Sub-agents
│ │ └── composer/ # Composer sub-agent
│ │ ├── agent.py # Composer agent implementation
│ │ ├── prompts.py # Prompts for the composer agent
│ │ └── tools.py # Tools for music generation
│ ├── main.py # Entry point for agents
│ └── pyproject.toml # Project configuration
└── chatui/ # Chat user interface
├── chatui/ # UI implementation
├── main.py # Entry point for the chat UI
└── pyproject.toml # Project configuration
This project is licensed under the terms included in the LICENSE file.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request