Rafael Uzarowski commited on
Commit
ded0cb5
·
unverified ·
1 Parent(s): 55eb35d

fix: change a2a context type to BACKGROUND

Browse files
agent.py CHANGED
@@ -29,7 +29,7 @@ from python.helpers.extension import call_extensions
29
  class AgentContextType(Enum):
30
  USER = "user"
31
  TASK = "task"
32
- MCP = "mcp"
33
 
34
 
35
  class AgentContext:
 
29
  class AgentContextType(Enum):
30
  USER = "user"
31
  TASK = "task"
32
+ BACKGROUND = "background"
33
 
34
 
35
  class AgentContext:
python/helpers/fasta2a_server.py CHANGED
@@ -11,7 +11,7 @@ from starlette.requests import Request
11
 
12
  # Local imports
13
  from python.helpers.print_style import PrintStyle
14
- from agent import AgentContext, UserMessage
15
  from initialize import initialize_agent
16
 
17
  # Import FastA2A
@@ -84,7 +84,7 @@ class AgentZeroWorker(Worker): # type: ignore[misc]
84
  if not context:
85
  # Create new context for this A2A conversation
86
  cfg = initialize_agent()
87
- context = AgentContext(cfg, id=context_id)
88
 
89
  # Log user message so it appears instantly in UI chat window
90
  context.log.log(
 
11
 
12
  # Local imports
13
  from python.helpers.print_style import PrintStyle
14
+ from agent import AgentContext, UserMessage, AgentContextType
15
  from initialize import initialize_agent
16
 
17
  # Import FastA2A
 
84
  if not context:
85
  # Create new context for this A2A conversation
86
  cfg = initialize_agent()
87
+ context = AgentContext(cfg, id=context_id, type=AgentContextType.BACKGROUND)
88
 
89
  # Log user message so it appears instantly in UI chat window
90
  context.log.log(
python/helpers/mcp_server.py CHANGED
@@ -140,7 +140,7 @@ async def send_message(
140
  persistent_chat = True
141
  else:
142
  config = initialize_agent()
143
- context = AgentContext(config=config, type=AgentContextType.MCP)
144
 
145
  if not message:
146
  return ToolError(
@@ -326,4 +326,4 @@ async def mcp_middleware(request: Request, call_next):
326
  status_code=403, detail="MCP server is disabled in settings."
327
  )
328
 
329
- return await call_next(request)
 
140
  persistent_chat = True
141
  else:
142
  config = initialize_agent()
143
+ context = AgentContext(config=config, type=AgentContextType.BACKGROUND)
144
 
145
  if not message:
146
  return ToolError(
 
326
  status_code=403, detail="MCP server is disabled in settings."
327
  )
328
 
329
+ return await call_next(request)