Spaces:
Sleeping
Sleeping
Download src/agents/default/agent.py from ColettoGS/zico-agent: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/spaces/ColettoGS/zico-agent/resolve/main/src/agents/default/agent.py
- Command line
-
hf download hf://spaces/ColettoGS/zico-agent/src/agents/default/agent.py
-
curl -L -o agent.py https://huggingface.co/spaces/ColettoGS/zico-agent/resolve/main/src/agents/default/agent.py
1.34 kB
| from langgraph.prebuilt import create_react_agent | |
| from src.agents.portfolio.tools import get_user_portfolio_tool | |
| from src.agents.markdown_instructions import MARKDOWN_INSTRUCTIONS | |
| DEFAULT_SYSTEM_PROMPT = f"""You are Zico, a friendly and knowledgeable AI assistant specializing in DeFi and cryptocurrency. | |
| You help users understand blockchain concepts, DeFi protocols, and crypto-related topics. | |
| Always respond in English, regardless of the user's language. | |
| Rules: | |
| - Be helpful, concise, and accurate. | |
| - For educational questions, explain concepts clearly with examples when useful. | |
| - If a question is outside your expertise, say so honestly. | |
| - For greetings and simple questions, keep responses brief and friendly. | |
| Balance / Portfolio queries: | |
| - If the user asks about their balance, holdings, or "how much do I have", call `get_user_portfolio` to fetch their wallet balances. | |
| - Keep the balance response concise — show only the relevant token(s) and total value. | |
| {MARKDOWN_INSTRUCTIONS}""" | |
| class DefaultAgent(): | |
| """Agent for handling default queries and data retrieval.""" | |
| def __init__(self, llm): | |
| self.llm = llm | |
| self.agent = create_react_agent( | |
| model=llm, | |
| tools=[get_user_portfolio_tool], | |
| name="default_agent", | |
| prompt=DEFAULT_SYSTEM_PROMPT, | |
| ) | |