Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variable in the README is incomplete. #642

Open
empeje opened this issue Jan 14, 2025 · 1 comment
Open

Environment variable in the README is incomplete. #642

empeje opened this issue Jan 14, 2025 · 1 comment

Comments

@empeje
Copy link

empeje commented Jan 14, 2025

I'm trying to run the app as an outsider but I have the following issues:

  1. When running tests through make tests-docker it turned out that the readme only suggested
MANIFOLD_API_KEY=...
BET_FROM_PRIVATE_KEY=...
OPENAI_API_KEY=...

Which is incomplete and also requires GRAPH_API_KEY and this GRAPH_API_KEY should be valid when running tests, and can't be jus a random string, so I need to generate one just to be able to run tests (unless for integration test, usually this kind of key can be mocked easily).

  1. Additionally, when I'm trying to run the agent through
python3.10 prediction_market_agent/run_agent.py coinflip omen

I got (given I only have above API Keys, the one in readme + theGRAPH_API_KEY ):

% python3.10 prediction_market_agent/run_agent.py coinflip omen
2025-01-15 00:03:29.749 | INFO     | prediction_market_agent_tooling.loggers:patch_logger:102 - Patched logger for default format.
WARNING:py.warnings:LangChainDeprecationWarning: Importing Chroma from langchain.vectorstores is deprecated. Please replace deprecated imports:\n\n>> from langchain.vectorstores import Chroma\n\nwith new imports of:\n\n>> from langchain_community.vectorstores import Chroma\nYou can use the langchain cli to **automatically** upgrade many imports. Please see documentation here <https://python.langchain.com/v0.2/docs/versions/v0_2/>
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\_'
WARNING:py.warnings:PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/
WARNING:py.warnings:LangChainDeprecationWarning: Importing Chroma from langchain.vectorstores is deprecated. Please replace deprecated imports:\n\n>> from langchain.vectorstores import Chroma\n\nwith new imports of:\n\n>> from langchain_community.vectorstores import Chroma\nYou can use the langchain cli to **automatically** upgrade many imports. Please see documentation here <https://python.langchain.com/v0.2/docs/versions/v0_2/>
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\ '
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\['
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\s'
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\.'
WARNING:py.warnings:DeprecationWarning: invalid escape sequence '\.'
WARNING:py.warnings:DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
WARNING:py.warnings:DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.\nImplementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
WARNING:py.warnings:DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google.cloud')`.\nImplementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
WARNING:py.warnings:DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.\nImplementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
WARNING:py.warnings:PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/
WARNING:langfuse:Langfuse client is disabled. No observability data will be sent.
Traceback (most recent call last):
  File "/Users/a-folder/prediction-market-agent/prediction_market_agent/run_agent.py", line 155, in <module>
    APP()
  File "/opt/homebrew/lib/python3.10/site-packages/typer/main.py", line 338, in __call__
    raise e
  File "/opt/homebrew/lib/python3.10/site-packages/typer/main.py", line 321, in __call__
    return get_command(self)(*args, **kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/typer/core.py", line 665, in main
    return _main(
  File "/opt/homebrew/lib/python3.10/site-packages/typer/core.py", line 197, in _main
    rv = self.invoke(ctx)
  File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/typer/main.py", line 703, in wrapper
    return callback(**use_params)
  File "/Users/a-folder/prediction-market-agent/prediction_market_agent/run_agent.py", line 151, in main
    RUNNABLE_AGENTS[agent]().run(market_type=market_type)
  File "/opt/homebrew/lib/python3.10/site-packages/prediction_market_agent_tooling/deploy/agent.py", line 509, in run
    self.before_process_markets(market_type)
  File "/opt/homebrew/lib/python3.10/site-packages/prediction_market_agent_tooling/deploy/agent.py", line 472, in before_process_markets
    self.check_min_required_balance_to_operate(market_type)
  File "/opt/homebrew/lib/python3.10/site-packages/prediction_market_agent_tooling/deploy/agent.py", line 352, in check_min_required_balance_to_operate
    raise CantPayForGasError(
prediction_market_agent_tooling.tools.custom_exceptions.CantPayForGasError: api_keys=APIKeys(MANIFOLD_API_KEY=SecretStr('**********'), METACULUS_API_KEY=None, METACULUS_USER_ID=None, BET_FROM_PRIVATE_KEY=SecretStr('**********'), SAFE_ADDRESS=None, OPENAI_API_KEY=SecretStr('**********'), GRAPH_API_KEY=SecretStr('**********'), TENDERLY_FORK_RPC=None, GOOGLE_SEARCH_API_KEY=None, GOOGLE_SEARCH_ENGINE_ID=None, LANGFUSE_SECRET_KEY=None, LANGFUSE_PUBLIC_KEY=None, LANGFUSE_HOST=None, LANGFUSE_DEPLOYMENT_VERSION=None, ENABLE_IPFS_UPLOAD=False, PINATA_API_KEY=None, PINATA_API_SECRET=None, TAVILY_API_KEY=None, SQLALCHEMY_DB_URL=None, ENABLE_CACHE=False, CACHE_DIR='./.cache') doesn't have enough operational balance.

Question is there any simplified way to test only one part of the agent just to test it's functionality?

@kongzii
Copy link
Contributor

kongzii commented Jan 15, 2025

Hey, indeed, README is a bit outdated.

Please take a look here to see what all keys might be required (it depends per agent/function etc.).

GRAPH_API_KEY can be obtained for free from https://thegraph.com, so mocking it isn't the top priority.

CantPayForGasError

This means that the private key you provided has 0 xDai on the Gnosis Chain. This assertion happens in the PMAT framework here.

The reason is that Omen lives on Gnosis Chain, and if the agent can not pay fees to submit transactions, there is no point in running him.

You could either send some xDai to your wallet, or set GNOSIS_RPC_URL environment variable to a local chain where you have funds (we useanvil to spin up local chains with dummy accounts with thousand of xDai).

Question is there any simplified way to test only one part of the agent just to test it's functionality?

You can do this:

from prediction_market_agent.agents.coinflip_agent.deploy import DeployableCoinFlipAgent
from prediction_market_agent_tooling.markets.omen.omen import OmenAgentMarket, SortBy

agent = DeployableCoinFlipAgent()
markets = OmenAgentMarket.get_binary_markets(limit=1, sort_by=SortBy.CLOSING_SOONEST)
prediction = agent.answer_binary_market(markets[0])

This will skip any checks and placing orders, so you can play with the prediction part only. You could also initialise OmenAgentMarket manually (it's normal Pydantic BaseModel) with your own question, that way even GRAPH_API_KEY isn't required.


Hope this helps, let us know if there are any other questions! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants