Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/appai/services/agents/deck_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
- Is the card affordable in terms of mana cost and mana colors that the deck can produce? If not, is it worth adjusting the mana base to accommodate the card, or should it be avoided in favor of a more affordable option?
- Consider the balance of the deck, including the mana curve, the mix of card types, and the overall consistency of the deck.
- Do not assume names of specific cards, beyond basic lands. The legal sets are constantly changing, so you cannot rely on prior knowledge of specific cards being available.
- When starting off, try to launch multiple searches for cards that will cover different aspects of the deck's strategy. By running searches in parallel, you can save time for the user.

## General flow:
Remember, a deck must have at least 60 cards, and no more than 4 copies of any individual card (other than basic lands).
Expand Down Expand Up @@ -194,6 +195,7 @@ async def run_deck_constructor_agent(
agent = Agent(
system_prompt=DECK_CONSTRUCTION_SYSTEM_PROMPT,
model=TOOL_MODEL_THINKING,
model_settings={'thinking': 'high'},
deps_type=DeckBuildingDeps,
tools=[
subagent_memory_search,
Expand Down Expand Up @@ -358,6 +360,7 @@ async def run_card_classifier_agent(deck_id: UUID, deck_description: str) -> Non
agent = Agent(
system_prompt=CARD_CLASSIFIER_SYSTEM_PROMPT,
model=TOOL_MODEL_BASIC,
model_settings={'thinking': False},
tools=[],
instrument=True,
retries=0,
Expand Down Expand Up @@ -448,6 +451,7 @@ async def run_card_replacement_agent(
agent = Agent(
system_prompt=CARD_REPLACEMENT_SYSTEM_PROMPT,
model=TOOL_MODEL_BASIC,
model_settings={'thinking': False},
tools=[],
instrument=True,
retries=0,
Expand Down
1 change: 1 addition & 0 deletions app/appai/services/agents/deck_theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def get_daily_deck_theme() -> NewTheme:
agent = Agent(
model=TOOL_MODEL_BASIC,
system_prompt=DECK_THEME_PROMPT,
model_settings={'thinking': False},
instrument=True,
output_type=NewTheme,
tools=[find_similar_themes],
Expand Down
1 change: 1 addition & 0 deletions app/appai/services/agents/filter_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ async def filter_constructor(query: str) -> Filter:
agent = Agent(
model=TOOL_MODEL_BASIC,
system_prompt=FILTER_CONSTRUCTION_PROMPT,
model_settings={'thinking': False},
output_retries=10,
output_type=Filter,
instrument=True,
Expand Down
1 change: 1 addition & 0 deletions app/appai/services/agents/guardrails.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def guardrail_agent(user_request: str, context: str) -> RelevancyScore:

agent = Agent(
model=TEXT_MODEL,
model_settings={'thinking': False},
system_prompt=get_guardrail_system_prompt(context),
output_retries=5,
output_type=RelevancyScore,
Expand Down
7 changes: 5 additions & 2 deletions app/appai/services/agents/tools/memory_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ async def write_memory(ctx: RunContext[DeckBuildingDeps], content: str, related_
None: This tool does not return any output, it simply records the memory for future reference.
"""
if len(related_card_uuids) > 10:
raise ValueError("A maximum of 10 related card UUIDs can be included in a memory.")
logfire.warning("Memory writing tool called with too many related_card_uuids.", count=len(related_card_uuids))
raise ModelRetry("A maximum of 10 related card UUIDs can be included in a memory.")
if len(related_card_uuids) > 0:
try:
await _check_related_card_uuids(related_card_uuids)
Expand All @@ -147,7 +148,8 @@ async def write_memory(ctx: RunContext[DeckBuildingDeps], content: str, related_
agent = Agent(
model=TOOL_MODEL_BASIC,
system_prompt=MEMORY_WRITING_AGENT_PROMPT,
output_type=Memory | None, # type: ignore [arg-type]
model_settings={'thinking': False},
output_type=Memory | None, # type: ignore [arg-type, call-overload]
retries=10,
output_retries=10,
instrument=True,
Expand Down Expand Up @@ -394,6 +396,7 @@ async def subagent_memory_search(ctx: RunContext[DeckBuildingDeps], query: str)
agent = Agent(
model=TOOL_MODEL_BASIC,
system_prompt=MEMORY_SEARCH_PROMPT,
model_settings={'thinking': False},
instrument=True,
tools=[semantic_memory_search, card_memory_search],
output_type=MemorySummary,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ dependencies = [
"jq>=1.11.0",
"tqdm>=4.67.1",
"kombu>=5.6.2",
"pydantic-ai>=1.58.0",
"pydantic>=2.12.5",
"pydantic-settings>=2.12.0",
"qdrant-client>=1.16.2",
Expand All @@ -40,6 +39,7 @@ dependencies = [
"authlib>=1.6.9",
"langchain-core>=1.2.22",
"pyasn1>=0.6.3",
"pydantic-ai>=1.87.0",
]

[dependency-groups]
Expand Down
Loading
Loading