Skip to main content

ADS4GPTs LangGraph agent. Integrate Ads into AI Agents and monetize.

Project description

ads4gpts-langgraph-agent

ADS4GPTs LangGraph agent. Integrate Ads into AI Agents and monetize.

Overview

The ads4gpts-langgraph-agent package provides a LangGraph agent that integrates advertising capabilities into AI agents. This allows for the seamless inclusion of promotional content within AI-driven conversations, enabling monetization opportunities.

Features

  • Contextual Ad Integration: Ads are integrated into conversations based on the context, ensuring relevance and engagement.
  • Customizable UX: Control where and how the ads are integrated within the graph.
  • Personalization & Context Blending: Make the ads desirable and relevant to increase User retention.
  • Privacy First: All sensitive data are being processed within your graph.
  • Support for Multiple LLM Providers: Compatible with OpenAI, Anthropic, and Groq models.
  • Logging: Configurable logging for monitoring and debugging.

Installation

To install the package, use the following command:

pip install ads4gpts-langgraph-agent

Usage

The ads4gpts-langgraph-agent is meant to be part of a single or multi-agent architectures, where the application aims to monetize with advertising. Key differentiator from all other solutions is that the Ad integration becomes part of the AI application UX.

You can control the Ad placement deterministically by introducing the ads4gpts-langgraph-agent as a node in the LangGraph graph:

from langgraph.graph import StateGraph, START, END
# State needs to have a messages field
# ConfigSchema needs to have gpt_id and session_id fields
from your_repo import ConfigSchema, State 
from ads4gpts_langgraph_agent import make_ads4gpts_langgraph_agent

graph_builder = StateGraph(State, ConfigSchema)
graph_builder.add_node("ads4gpts_node", make_ads4gpts_langgraph_agent())

Follow the subgraph_example in the examples folder for a complete implementation of this approach.

On the other hand you let other agents call the ads4gpts-langgraph-agent autonomously through tool execution:

from langgraph.graph import StateGraph, START, END
# State needs to have a messages field
# ConfigSchema needs to have gpt_id and session_id fields
from your_repo import ConfigSchema, State 
from ads4gpts_langgraph_agent import make_ads4gpts_langgraph_agent, make_handoff_tool

ads4gpts_agent =  make_ads4gpts_langgraph_agent()
ads4gpts_tool = make_handoff_tool(ads4gpts_agent)

Follow the tool_example in the examples folder for a complete implementation of the tool approach.

Configuration

The agent requires several configuration parameters, which can be provided through environment variables or directly in the code through the make_ads4gpts_langgraph_agent constructor function:

  • ADS4GPTS_API_KEY: API key for ADS4GPTs.
  • ADS4GPTS_BASE_URL: Base URL for ADS4GPTs API. You can omit that to use the default settings.
  • ADS4GPTS_ADS_ENDPOINT: Endpoint for fetching ads. You can omit that to use the default settings.
  • PROVIDER: LLM provider (e.g., openai, anthropic, groq).
  • {PROVIDER}_API_KEY: API key for the selected LLM provider e.g. OPENAI_API_KEY.

Testing

To run the tests, use the following command:

pytest tests/

License

This project is licensed under the GNU AGPLv3 License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

Contact

For any questions or inquiries, please contact the ADS4GPTs team at contact@ads4gpts.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ads4gpts_langgraph_agent-0.1.7.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ads4gpts_langgraph_agent-0.1.7-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file ads4gpts_langgraph_agent-0.1.7.tar.gz.

File metadata

File hashes

Hashes for ads4gpts_langgraph_agent-0.1.7.tar.gz
Algorithm Hash digest
SHA256 6c5ad83b08ebc6f64360ec0da5ccfbce4f6955a0df1b41282093c5eb5f347d96
MD5 d226714d636387afd7a2e2bc18ac9f8d
BLAKE2b-256 65ddb8619e2e8913870b87c2a5e17ad0421b07f6ec1b85bab4243e744655acb8

See more details on using hashes here.

File details

Details for the file ads4gpts_langgraph_agent-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for ads4gpts_langgraph_agent-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 50318a56ab0a49e316010af673de6da97fc6bc943cc22e315b28fc8efc6cdf70
MD5 0e6f649c93cb9421923eae75e1c65caf
BLAKE2b-256 1a70b0c4b91ed9b3b1d62334cf259b532c88f3eaa1f76d43623f58de56af0fc8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page