TRADING_AGENT_SYSTEM_PROMPT = """You are an autonomous prediction market trading agent.Your goal is to maximize long-term profit by:1. Finding underpriced markets2. Conducting research on market outcomes3. Placing well-sized bets4. Managing risk appropriatelyYou have access to tools for market analysis, web research, and trading.Use them strategically to achieve your goals.Available functions:{functions_summary}"""
JUST_BORN_SYSTEM_PROMPT = """You are a newly created prediction market trading agent.You have been given tools but minimal instructions.Your task is to:1. Learn about prediction markets through exploration2. Develop your own trading strategy3. Refine your approach based on results4. Modify this system prompt to encode your learningsYou can update your system prompt using the modify_system_prompt() tool.Available functions:{functions_summary}"""
# Agent can modify its own behavior:1. Initial run with minimal prompt2. Agent explores markets and tools3. Agent analyzes what works/doesn't work4. Agent updates system prompt with learnings5. Updated prompt persists to database6. Next run uses improved prompt7. Repeat cycle
class DeployableMicrochainModifiableSystemPromptAgent3( DeployableMicrochainModifiableSystemPromptAgentAbstract): identifier = MICROCHAIN_AGENT_OMEN_LEARNING_3 model = SupportedModel.llama_31_instruct max_iterations = 10 # Replicate API has 4096 token limit
class DeployableMicrochainWithGoalManagerAgent0(DeployableMicrochainAgent): identifier = MICROCHAIN_AGENT_OMEN_WITH_GOAL_MANAGER model = SupportedModel.gpt_4o functions_config = TRADING_AGENT_SYSTEM_PROMPT_MINIMAL_CONFIG.functions_config initial_system_prompt = TRADING_AGENT_SYSTEM_PROMPT_MINIMAL_CONFIG.system_prompt def build_goal_manager(self, agent: Agent) -> GoalManager: return GoalManager( agent_id=self.identifier, high_level_description="You are a trader agent in prediction markets, aiming to maximise your long-term profit.", agent_capabilities=f"You have the following capabilities:\n{get_functions_summary_list(agent.engine)}", retry_limit=1, goal_history_limit=10, )
Goal( description="Place a profitable bet on a market about US politics", success_criteria="Bet placed with >60% confidence on underpriced outcome", time_limit="1 hour",)
Execution: Agent works toward goal using available tools
Evaluation: LLM evaluates if goal was achieved
evaluation = """Goal: Place profitable bet on US politics marketStatus: SUCCESSReasoning: Found market trading at 40% for likely outcome (should be 70%),placed $2 bet with Kelly sizing."""
TRADING_AGENT_SYSTEM_PROMPT_MINIMAL = """You are a trader agent in prediction markets.Your current goal:{goal}Use your tools to achieve this goal efficiently."""
Goal Manager injects the current goal into the prompt.
from prediction_market_agent.agents.microchain_agent.nft_treasury_game.deploy_nft_treasury_game import ( DeployableAgentNFTGame1, DeployableAgentNFTGame2, # ... through DeployableAgentNFTGame7)
Each agent has unique configuration for multi-agent game scenarios.
class DeployableMicrochainAgent: import_actions_from_memory = 10 # Import last 10 actions import_actions_from_memory_from = DatetimeUTC(2024, 1, 1) # Or from date def initialise_agent(self) -> None: if self.import_actions_from_memory: latest_saved_memories = self.long_term_memory.search( limit=self.import_actions_from_memory, from_=self.import_actions_from_memory_from, ) # Inject memories into agent history self.agent.history[1:1] = [m.metadata_dict for m in latest_saved_memories]
class MyMicrochainAgent(DeployableMicrochainAgentAbstract): max_iterations = 50 # Maximum iterations per run sleep_between_iterations = 5 # Seconds to sleep between iterations allow_stop = True # Agent can stop itself early
# Start with minimal promptagent = DeployableMicrochainModifiableSystemPromptAgent0( max_iterations=30, # Give time to explore import_actions_from_memory=5, # Learn from recent history)
# Agent history is saved after each iterationhistory = LongTermMemoryTableHandler.from_agent_identifier(agent.identifier)messages = history.search(limit=100)for message in messages: print(f"{message.role}: {message.content}")