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
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""add unhealthy status

Revision ID: a5d67f2d7356
Revises: 329fbafa4ff9
Create Date: 2025-11-04 19:23:22.904744

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'a5d67f2d7356'
down_revision: Union[str, None] = '329fbafa4ff9'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.execute("""
ALTER TYPE agentstatus ADD VALUE IF NOT EXISTS 'UNHEALTHY';
""")
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""add agent input type

Revision ID: 24429f13b8bd
Revises: a5d67f2d7356
Create Date: 2025-11-04 23:40:10.340272

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '24429f13b8bd'
down_revision: Union[str, None] = 'a5d67f2d7356'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
# Alembic doesn't create enum types on table updates, so we need to do it manually
op.execute("""
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'agentinputtype') THEN
CREATE TYPE agentinputtype AS ENUM ('TEXT', 'JSON');
END IF;
END $$;
""")
op.add_column('agents', sa.Column('agent_input_type', sa.Enum('TEXT', 'JSON', name='agentinputtype', create_type=False), nullable=True))
Comment on lines +28 to +32
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The database enum uses uppercase values ('TEXT', 'JSON'), but the Python AgentInputType enum uses lowercase values ('text', 'json'). This mismatch will cause runtime errors when inserting or querying data. The enum values must match exactly between the database and Python code.

Suggested change
CREATE TYPE agentinputtype AS ENUM ('TEXT', 'JSON');
END IF;
END $$;
""")
op.add_column('agents', sa.Column('agent_input_type', sa.Enum('TEXT', 'JSON', name='agentinputtype', create_type=False), nullable=True))
CREATE TYPE agentinputtype AS ENUM ('text', 'json');
END IF;
END $$;
""")
op.add_column('agents', sa.Column('agent_input_type', sa.Enum('text', 'json', name='agentinputtype', create_type=False), nullable=True))

Copilot uses AI. Check for mistakes.
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('agents', 'agent_input_type')
# ### end Alembic commands ###
4 changes: 3 additions & 1 deletion agentex/database/migrations/migration_history.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
d7addd4229e8 -> 329fbafa4ff9 (head), change_default_acp_to_async
a5d67f2d7356 -> 24429f13b8bd (head), add agent input type
329fbafa4ff9 -> a5d67f2d7356, add unhealthy status
d7addd4229e8 -> 329fbafa4ff9, change_default_acp_to_async
09368a02d6cc -> d7addd4229e8, soft delete status
739800d3e1ce -> 09368a02d6cc, deployment history
dbac39ab82c3 -> 739800d3e1ce, registration metadata
Expand Down
41 changes: 41 additions & 0 deletions agentex/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ services:
- MONGODB_URI=mongodb://agentex-mongodb:27017
- MONGODB_DATABASE_NAME=agentex
- WATCHFILES_FORCE_POLLING=true
- ENABLE_HEALTH_CHECK_WORKFLOW=true
- AGENTEX_SERVER_TASK_QUEUE=agentex-server
ports:
- "5003:5003"
volumes:
Expand Down Expand Up @@ -187,6 +189,45 @@ services:
retries: 5
start_period: 30s

agentex-temporal-worker:
container_name: agentex-temporal-worker
build:
context: ..
dockerfile: agentex/Dockerfile
target: dev
environment:
- ENVIRONMENT=development
- DATABASE_URL=postgresql://postgres:postgres@agentex-postgres:5432/agentex
- TEMPORAL_ADDRESS=agentex-temporal:7233
- TEMPORAL_HOST=agentex-temporal
- REDIS_URL=redis://agentex-redis:6379
- MONGODB_URI=mongodb://agentex-mongodb:27017
- MONGODB_DATABASE_NAME=agentex
- AGENTEX_SERVER_TASK_QUEUE=agentex-server
volumes:
- .:/app:cached
depends_on:
agentex-temporal:
condition: service_healthy
agentex-redis:
condition: service_healthy
agentex-postgres:
condition: service_healthy
agentex-mongodb:
condition: service_healthy
networks:
- agentex-network
command: |
bash -c "
echo 'Starting Temporal Worker...' &&
export TEMPORAL_ADDRESS=agentex-temporal:7233 &&
export TEMPORAL_HOST=agentex-temporal &&
export MONGODB_URI=mongodb://agentex-mongodb:27017 &&
python src/temporal/run_worker.py
"
user: root
restart: unless-stopped

volumes:
agentex-temporal-postgres-data:
agentex-postgres-data:
Expand Down
3 changes: 2 additions & 1 deletion agentex/src/adapters/orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from sqlalchemy.orm import relationship

from src.domain.entities.agent_api_keys import AgentAPIKeyType
from src.domain.entities.agents import AgentStatus
from src.domain.entities.agents import AgentInputType, AgentStatus
from src.domain.entities.tasks import TaskStatus
from src.utils.ids import orm_id

Expand All @@ -41,6 +41,7 @@ class AgentORM(BaseORM):
)
registration_metadata = Column(JSONB, nullable=True)
registered_at = Column(DateTime(timezone=True), nullable=True)
agent_input_type = Column(SQLAlchemyEnum(AgentInputType), nullable=True)

# Many-to-Many relationship with tasks
tasks = relationship("TaskORM", secondary="task_agents", back_populates="agents")
Expand Down
Empty file.
Loading